ThumbsUp
02-09-2012, 06:20 AM
Hello all,
My first post on your excellent forum. As a new VBA user, I've been able to search and find all the answers I need...except one.
I have an Excel 2007 spreadsheet of data that is manipulated by VBA code to produce a Pivot Table. Then, it shows the Detail behind one of the Pivot Table subtotals by creating a ListObject Table. I then address that Table as a sheet and am able to print it.
My problem is that I cannot, for the life of me, figure out how to reference the Table so that it can be formatted to one of the Design styles offered in Excel 2007. Excel is naming the Table something like "Table8", increasing by one each time a Table is produced.
I need to be able to address the Table name dynamically so that no matter how many time the code is run, the reference to the Table is correct.
Here is a simple procedure to illustrate my problem:
Sub FormatDetailTbl()
ActiveSheet.ListObjects("Table8").TableStyle = "TableStyleLight9"
End Sub
Thanks for any help you can offer.
Greg
My first post on your excellent forum. As a new VBA user, I've been able to search and find all the answers I need...except one.
I have an Excel 2007 spreadsheet of data that is manipulated by VBA code to produce a Pivot Table. Then, it shows the Detail behind one of the Pivot Table subtotals by creating a ListObject Table. I then address that Table as a sheet and am able to print it.
My problem is that I cannot, for the life of me, figure out how to reference the Table so that it can be formatted to one of the Design styles offered in Excel 2007. Excel is naming the Table something like "Table8", increasing by one each time a Table is produced.
I need to be able to address the Table name dynamically so that no matter how many time the code is run, the reference to the Table is correct.
Here is a simple procedure to illustrate my problem:
Sub FormatDetailTbl()
ActiveSheet.ListObjects("Table8").TableStyle = "TableStyleLight9"
End Sub
Thanks for any help you can offer.
Greg