150 列までの非常に大きなシートがあり、そのほとんどに数式が含まれています。数式を使用していないセルに入力したデータを並べ替えたい場合、シート全体がめちゃくちゃになります。- 入力セルが一緒ではありません
現在、VBA での私の解決策は、セルを別の (非表示の) シートにコピーし、並べ替えて元に戻すことです。一見単純なタスクに対して、これはあまりにも多くの作業であると感じています。これを解決するよりスマートな方法はありますか?
編集
qua @varocarbas私は次のコードを試しました:
Private Sub sortInputButton_Click()
' This sub sorts the inpur, without messing up the references [hopefully]
Dim rowCount As Integer
Dim colCount As Integer
rowCount = countItems
colCount = 180
Dim inputRange As Range
Set inputRange = Sheets("Input").Range("A3")
Set inputRange = inputRange.Resize(rowCount, colCount)
Dim targetRange As Range
On Error Resume Next ' If range is nothing, throws an error - we don't want that
Set targetRange = inputRange.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If targetRange.Cells.count > 0 Then
Sheets("Input").Select
targetRange.Select
Call targetRange.Sort(Sheets("Input").Range("A3"), xlAscending)
End If
End Sub
しかし、これは私にエラーを与えますthe command you chose cannot be performed with multiple selections. Select a single range and click the command again.