本帖最后由 lss001 于 2024-8-24 06:38 编辑
Sub Index拆分数组()
ar = Range("A1:C3")
r = UBound(ar)
x = UBound(ar, 2)
c = Split(Cells(1, x).Address, "$")(1)
ar1 = Application.Index(ar, , 2) '1列/2
ar2 = Application.Index(ar, Evaluate( _
"Row(1:" & r & ")"), [{2,3}]) '多列/2-3
ar3 = Application.Index(ar, 2) '1行/2
ar4 = Application.Index(ar, [{2;3}], _
Evaluate("Column(a:" & c & ")")) '多行/2-3
ar5 = Application.Index(ar, Evaluate( _
"Row(1:" & r & ")"), [{1,3}]) '隔列/1,3
ar6 = Application.Index(ar, [{1;3}], _
Evaluate("Column(a:" & c & ")")) '隔行/1;3
End Sub
|