View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default find last row on a worksheet

Ed,

LastRow should be Dim'ed as Integer or Long, not String, as it is a number.

Also, this

LastRow = Range("A" & Rows.Count).End(xlUp).Row

is a little more flexible.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ed" wrote in message
...
Hi, Tracey. I do it like this:

Dim LastRow As String
LastRow = Range("AD65536").End(xlUp).Row

Then use LastRow any time I need to identify that row (as in Range("D" &
LastRow).Select or
Loop Until ThisRow LastRow.

HTH
Ed

"tracey" wrote in message
...
I'm sure this is easy but I can't seem to figure it out.
How do get a row count on a worksheet? I wrote code that
will delete blank rows but every spreadsheet is different
and the code keeps running to overflow