gino59
Active Member
- Joined
- Jul 26, 2010
- Messages
- 496
Hi all,
I have a query which dumps a data range into a worksheet. The data always takes thirteen columns and a variable number of rows. Is there a way to count the number of rows after the query returns the data range and then use that count to specify the size of an Excel 2007 table?
Right now, I'm using the following code to size the table but as you can see, the range is specified using row/column designations.
It would be good to...
1) write the data to the sheet (got that part done)
2) count the number of rows used in the sheet
3) size the table as A1:Mxxxx where xxxx is the variable number found by counting the range rows.
Many thanks as always!
Cheers,
Gino
I have a query which dumps a data range into a worksheet. The data always takes thirteen columns and a variable number of rows. Is there a way to count the number of rows after the query returns the data range and then use that count to specify the size of an Excel 2007 table?
Right now, I'm using the following code to size the table but as you can see, the range is specified using row/column designations.
Code:
Range("A1").Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$M$2200"), , xlYes).Name = "tbl1"
It would be good to...
1) write the data to the sheet (got that part done)
2) count the number of rows used in the sheet
3) size the table as A1:Mxxxx where xxxx is the variable number found by counting the range rows.
Many thanks as always!
Cheers,
Gino