Arr1=Worksheets("表一").Range("A1:B10")
Arr2=Worksheets("表二").Range("A1:B10")
Arr3=Worksheets("表三").Range("A1:B10")
在For i=1 to 3循环中,怎样当i=1时引用数组Arr1,i=2时引用数组Arr2,i=3时引用数组Arr3?
实际上就是用变量表示数组名称的问题
第1个回答 推荐于2017-09-17
Sub kkk()
Dim arr(1 To 3) As Range
For i = 1 To 3
Set arr(i) = Worksheets("表" & i).Range("A1:B10")
For Each c In arr(i)
c.Value = 0
Next
Next
End Sub本回答被提问者采纳
Dim arr(1 To 3) As Range
For i = 1 To 3
Set arr(i) = Worksheets("表" & i).Range("A1:B10")
For Each c In arr(i)
c.Value = 0
Next
Next
End Sub本回答被提问者采纳