我正在尝试确定特定行中已使用列的数量并将它们向右移动。这是我到目前为止所做的,但这似乎不起作用。请帮忙。
Dim LastCol As Integer
LastCol = DataSheet.Cells(arr(z)(1), DataSheet.Cells(arr(z)(1).Columns.Count))
'arr(z)(1) is an integer extracted from a 2 multidimensional array
Dim rng As Range
Set rng = Range(DataSheet.Cells(arr(z)(1), 2), DataSheet.Cells(arr(z)(1),LastCol))
rng.Insert Shift:=xlRight
答案 0 :(得分:0)
Dim LastCell as Range
With DataSheet
Set lastCell = .Cells(arr(Z)(1), Columns.Count).End(xlToLeft)
.Range(.Cells(arr(Z)(1), 2), lastCell).Insert Shift:=xlShiftToRight
End With