0
谁能帮我弄清楚为什么这个代码错误是“下标超出范围”。 (运行时错误9)下标超出范围VBA代码
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
这将取决于你的数组声明。显示宣言行。作为'昏暗arrayx(...' –
昏暗strDate 昏暗算作整数 昏暗arrayU()作为变 昏暗arrayX()作为变 昏暗arrayW()作为变 昏暗LrowU作为整数 昏暗LrowX作为整数 Dim LrowW As Integer Dim i As Integer Dim j As Integer Dim bed_in_use As Integer – Zapata
不在评论中,请将它放在原始文章中 –