Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determining End Of data

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Determining End Of data

Hi BNH,

Perhaps this will help:

Sub Tester()
Dim LastRow As Long
Dim LastCol As Long
Const col As String = "A" '<<=== CHANGE
Const RW As Long = 2 '<<=== CHANGE


LastRow = Cells(Rows.Count, col).End(xlUp).Row

LastCol = Cells(RW, Columns.Count).End(xlToLeft).Column

Debug.Print LastCol, LastRow

End Sub

---
Regards,
Norman



"bnhcomputing" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
determining best data using functions? ivory_kitten Excel Worksheet Functions 2 July 13th 09 03:16 PM
Determining the data type. satadru Excel Discussion (Misc queries) 6 September 8th 08 08:39 AM
Determining the text mode from a variety of data types matt3542 Excel Worksheet Functions 17 July 31st 08 08:01 PM
Determining the number of cells with data in a column Ken Loomis Excel Programming 5 July 11th 05 02:07 AM
Need help determining # of invoices Brad Excel Discussion (Misc queries) 1 March 1st 05 06:16 PM


All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"