Find The Last Used Row
Hey FSt1,
Thanks for the reply.
Your solution will only work if I add .Row to the end of that
statement like this:
__________________________________________________ _
lLastRow = Sheets("CustList").Cells("65536", _
"A").End(xlUp).Rows.Offset(1, 0).Row
__________________________________________________ _
The key was the "s" on Rows, which made it a type mismatch, until the
addition of .Row at the tail end. Now this modification works.
However, I do appreciate the attempt.
-Minitman
On Fri, 6 Jun 2008 15:06:01 -0700, FSt1
wrote:
hi
llastrow is declared as a long which is a number.
the offset method applies to a range object so you have a type mismatch.
instead of....
lLastRow = Sheets("CustList").Cells("65536", _
"A").End(xlUp).Rows.Offset(1, 0)
use...
lLastRow = Sheets("CustList").Cells("65536", _
"A").End(xlUp).Rows + 1
regards
FSt1
"Minitman" wrote:
Greetings,
I am trying to display the last row in column A in a MsgBox with this
code on a CommandButton with this code:
______________________________________________
Private Sub CommandButton1_Click()
Dim lLastRow As Long
lLastRow = Sheets("CustList").Cells("65536", _
"A").End(xlUp).Rows.Offset(1, 0)
MsgBox "Last row plus 1 = " & lLastRow
End Sub
______________________________________________
The MsgBox says "Last Row plus 1 = 0"
There are 2913 rows in column A..
Can anyone see what is wrong with this code?
Any help will be appreciated.
-Minitman
|