Rufus Clupea
Board Regular
- Joined
- Feb 11, 2019
- Messages
- 85
Can't quite see/figure out what I've done wrong (I don't know what I don't know
).
I'm getting:
Run-time error '1004'
Method 'Range' of object '_Global' failed
I've tracked the error down (I think) to the FOR-NEXT loops in the following snippet of code (edited for brevity/relevance):
If I "comment" the FOR-NEXT loops, everything runs fine, so I'm assuming (as perilous as that can be
) that the FOR-NEXT loops are--somehow--the problem. When Un-commented is when I get the error.

I'm getting:
Run-time error '1004'
Method 'Range' of object '_Global' failed
I've tracked the error down (I think) to the FOR-NEXT loops in the following snippet of code (edited for brevity/relevance):
Code:
Option Explicit 'ALL VARIABLES MUST BE DECLARED
Option Base 1 'DEFAULT LOWER LIMIT OF ARRAYS = 1
'------------------------------------
' GLOBAL DECLARATIONS
'------------------------------------
Dim Array1(1 To 13, 1 To 2) As String
Dim Array2(1 To 13, 1 To 2) As String
'------------------------------------
Private Sub Update_Arrays()
Dim i As Integer 'FOR-NEXT Index
Dim a As Integer 'Array1 Index
Dim d As Integer 'Array2 Index
Dim row As Integer
a = 1 'Array1 Index
d = 1 'Array2 Index
'------------------------------------------------
' CODE (Deleted) changes the values of a and d
' to Integers between 1 and 9.
'------------------------------------------------
For i = 1 To a
row = 39 + i:
Range(Cells(row, 1)).Text = Array1(i, 1):
Range(Cells(row, 2)).Text = Array1(i, 2)
Next i
For i = 1 To d
row = 39 + i:
Range(Cells(row, 11)).Text = Array2(i, 1):
Range(Cells(row, 12)).Text = Array2(i, 2)
Next i
End Sub
If I "comment" the FOR-NEXT loops, everything runs fine, so I'm assuming (as perilous as that can be
