View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Last cell in column


one other thing i wanted to add but forgot,

this line:
LastCell = ws.Cells(Rows.Count, 5).End(xlUp)
would not have errored if you had a number in the "lastcell" because it was
dimmed as double. "lastcell" would have been = to the value of that last cell if
you dimmed it as long or variant or some other type that can hold whatever was
stored in that cell.
--


Gary

"Paul Wilson" wrote in message
...
Hi,

I just wanted to find out the number of rows based on the last cell which
has data.

I have been trying to use the following

Dim LastCell As Double
LastCell = Cells(Rows.Count, 5).End(xlUp)

But get a VBA error.
--
Paul Wilson