任何人都可以帮我弄清楚为什么这个代码错误是“下标超出范围”。 (运行时错误9)
Dim arrayU() As Variant
Dim arrayX() As Variant
Dim arrayW() As Variant
Dim LrowU As Integer
Dim LrowX As Integer
Dim LrowW As Integer
Dim i As Integer
Dim j As Integer
Dim bed_in_use As Integer
For i = 3 To LrowX
For r = 3 To LrowW
For j = 3 To LrowX
If bed_in_use >= 24 Then Exit For
If arrayX(i) = arrayW(r) Then
bed_in_use = bed_in_use - 1
If arrayX(i) = arrayU(j) Then
bed_in_use = bed_in_use + 1
Cells(i, "Y").Value = bed_in_use
End If
End If
答案 0 :(得分:0)
检查this page以获取有关此错误的信息。
在你的情况下,我说这是第一个选择:
检查 i , r 和 j 的值是否大于为其标注尺寸的数组的值...
要么是: