Could anyone help me to figure out why this code erro is "subscript is out of range". (run time error 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