View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Determining End Of data

To determine the last row of data you are best off to go to the last row in
the spreadsheet (65,536) and then move up from there until a non blank cell
is found something like this

msgbox sheet1.cells(rows.count, "A").end(xlup).row
--
HTH...

Jim Thomlinson


"bnhcomputing" wrote:

I have a query that brings in data. Sometime 10 rows, sometimes 50.

I have a macro that creates a pivot table of the returned data.

If I code the pivot for 10 rows of data, the pivot will be incorrect when
anything other than 10 rows of data is returned.

How do I determine what the last row of data is OR the number of rows of
data? Is there a funtion that can look at each row and tell me what the
first empty/blank row is?

Thanks in advance
--
bnhcomputing