dim shuzu(10,10) as Variant
shuzu(1,1)="aa"
shuzu(1,2)="bb"
shuzu(1,3)="cc"
shuzu(1,4)="dd"
shuzu(2,1)="11"
shuzu(2,2)="22"
shuzu(2,3)="33"
以上的数组,如何用vba语句得到指定行的列的实际个数
譬如上面行为1的列个数为4
行为2,列个数为3
谢谢!!
Sub test()
Dim shuzu(1 To 10, 1 To 10) As String
shuzu(1, 1) = "aa"
shuzu(1, 2) = "bb"
shuzu(1, 3) = "cc"
shuzu(1, 4) = "dd"
shuzu(2, 1) = "11"
shuzu(2, 2) = "22"
shuzu(2, 3) = "33"
For i = 1 To 10
MsgBox "行为" & i & "的列个数为" & Application.Match("", Application.Index(shuzu, i, 0), 0) - 1
Next
End Sub
Dim shuzu(1 To 10, 1 To 10) As String
shuzu(1, 1) = "aa"
shuzu(1, 2) = "bb"
shuzu(1, 3) = "cc"
shuzu(1, 4) = "dd"
shuzu(2, 1) = "11"
shuzu(2, 2) = "22"
shuzu(2, 3) = "33"
For i = 1 To 10
MsgBox "行为" & i & "的列个数为" & Application.Match("", Application.Index(shuzu, i, 0), 0) - 1
Next
End Sub
温馨提示:答案为网友推荐,仅供参考