View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_2_] Gary Keramidas[_2_] is offline
external usenet poster
 
Posts: 364
Default Last cell in column

you need .row after your statement you should also use long instead of
double and qualify the range. you can also use the column letter if it makes
it easier.

Dim LastCell As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
LastCell = ws.Cells(Rows.Count, "E").End(xlUp).Row



--

Gary
Excel 2003


"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