View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
HeatherO HeatherO is offline
external usenet poster
 
Posts: 41
Default counting # rows in a worksheet

Thanks this is exactly what I was looking for, it works and it's quick.
Merci Beaucoup

" wrote:

Try

Dim cLastRow As Long
Dim rng As Range

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("A2:G" & cLastRow)

Brian M


"HeatherO" wrote in message
...
I currently have a program that opens up mutiple workbooks anyways I am
never
sure of how many rows of data are in the worksheet that I need to use for
a
vlookup in which I need to access the whole range. One day the workbook
could have data stored from A2:G55 and the next A2:G100. I was just
wondering if there is a way to count the number of rows in a worksheet
that
hold data so I could pick the right range to lookup. Something like a
rowcount() maybe?
Any help is appreciated.
Thanks a bunch.