mgirvin
Well-known Member
- Joined
- Dec 15, 2005
- Messages
- 1,248
- Office Version
- 365
- Platform
- Windows
Dear Excel Team,
I am new to VBA. I am reading the Mr Excel VBA book. I have defined a variable:
FinalRow = Cells(65530, 2).End(x1Up).Row
Every time I hit F8 and Execute, I get Error "Run time error 1004, Application-defined or object-defined error". I am pretty sure the problem is with the ".End(x1up)", however, this is how it is typed in the book.
The whole code is this:
'Test FinalRow
'by Gel 8/25/06
Sub TestFinalRow()
FinalRow = Cells(65530, 2).End(x1Up).Row
For i = 2 To FinalRow
If Cells(i, 2).Value > 0 Then
Cells(i, 2).Interior.ColorIndex = 6
End If
Next i
End Sub
Sincerely, Mike Gel Girvin
I am new to VBA. I am reading the Mr Excel VBA book. I have defined a variable:
FinalRow = Cells(65530, 2).End(x1Up).Row
Every time I hit F8 and Execute, I get Error "Run time error 1004, Application-defined or object-defined error". I am pretty sure the problem is with the ".End(x1up)", however, this is how it is typed in the book.
The whole code is this:
'Test FinalRow
'by Gel 8/25/06
Sub TestFinalRow()
FinalRow = Cells(65530, 2).End(x1Up).Row
For i = 2 To FinalRow
If Cells(i, 2).Value > 0 Then
Cells(i, 2).Interior.ColorIndex = 6
End If
Next i
End Sub
Sincerely, Mike Gel Girvin