View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
GKeramidas GKeramidas is offline
external usenet poster
 
Posts: 38
Default lastrow question

thanks for the explanation norman. so, is the way i have it return 45 the
best way, then?

--


Gary


"Norman Jones" wrote in message
...
Hi Gary,

sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64


The expression is eqiuvalent to:

sLastRow = .Cells(Rows.Count, "B").End(xlUp).Cells.Item(3).Row

or

sLastRow = .Cells(Rows.Count, "B").End(xlUp).Offset(2).Row



---
Regards,
Norman



"GKeramidas" wrote in message
...
have text in rows 61 and 62 and i want the lastrow before that (45). i
know i can start at the top and go down, but i want to do this.

anyway

sLastRow = .Cells(Rows.Count, "B").End(xlUp).Row ' gives me 62
sLastRow = .Cells(Rows.Count, "B").End(xlUp)(3).Row 'gives me 64
sLastRow = .Cells(Rows.Count, "B").End(xlUp).End(xlUp).End(xlUp).Row
'gives me 45, which is what i want

why doesn't the 2nd one work?
--


Gary