Reputation: 391
Following a tutorial for arrays on VBA Excel. As you can see, just about everything is commented out and I still get this error. If I use Range("A1", "A1").Value = 1 there's no problem. I also noticed that the intelisense doesn't pick up 'Cells('
Option Explicit
Sub ArrayTest()
'Dim arrayint(1 To 5) As Integer
'Dim i As Integer
'Dim j As Integer
' For j = 1 To UBound(arrayint)
' arrayint(j) = 10 * j
' Next j
' For i = i To UBound(arrayint)
Cells(1, 1).Value = 1 'arrayint(i)
' Next i
End Sub
Upvotes: 2
Views: 12978
Reputation: 19727
Try using Application
and check if Intellisense
picks up Cells
property.
If so, replace your code by this:
Application.Cells(1, 1).Value = 1
Upvotes: 3
Reputation: 26
You have not commented the line
Cells(1, 1).Value = 1 'arrayint(i)
This may be the reason for error.
Upvotes: 1