![]() |
Record Pivot Table Macro
I'm trying to incorporate a pivot table creation in a macro, but can't get
around the specific name of the sheet it's identifying. For instance, the code states '1205 Aging' as the sheet name in the code. Obviously this would be different each month so the macro wouldn't be 'universal'. Any ideas? Thanks. |
Record Pivot Table Macro
If the macro will be run from the sheet containing the data, you can replace
the SourceData portion of the code to reference the ActiveSheet, rather than using a fixed sheet name. For example, change SourceData:="Sheet1!R1C1:R5C2" to SourceData:=ActiveSheet.Name & "!R1C1:R5C2" --Bruce "Corey" wrote: I'm trying to incorporate a pivot table creation in a macro, but can't get around the specific name of the sheet it's identifying. For instance, the code states '1205 Aging' as the sheet name in the code. Obviously this would be different each month so the macro wouldn't be 'universal'. Any ideas? Thanks. |
Record Pivot Table Macro
Thanks! That worked fine.
"bpeltzer" wrote: If the macro will be run from the sheet containing the data, you can replace the SourceData portion of the code to reference the ActiveSheet, rather than using a fixed sheet name. For example, change SourceData:="Sheet1!R1C1:R5C2" to SourceData:=ActiveSheet.Name & "!R1C1:R5C2" --Bruce "Corey" wrote: I'm trying to incorporate a pivot table creation in a macro, but can't get around the specific name of the sheet it's identifying. For instance, the code states '1205 Aging' as the sheet name in the code. Obviously this would be different each month so the macro wouldn't be 'universal'. Any ideas? Thanks. |
All times are GMT +1. The time now is 02:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com