7,759
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private marrCellText(10, 5) As String
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
'遍历数组赋值
For i = LBound(marrCellText, 1) To UBound(marrCellText, 1)
For j = LBound(marrCellText, 2) To UBound(marrCellText, 2)
marrCellText(i, j) = "这是数组元素" & i & "," & j
Next
Next
MsgBox marrCellText(2, 3) '自己改变下标进行测试
End Sub
Private Sub Command2_Click()
'数组作用域演示
MsgBox "跨函数还是能访问到数组" & marrCellText(5, 4)
End Sub