Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I'm in Excel 2010 and using the code below to do some pivot table
work. In several of the lines of code the pivot table is identified as PivotTable6. This worries me because I want it to be able to run on Pivot tables of the future that will most likely not have that name. Is there a way that I can modify this code to have it identify the pivot table correctly without actually using its name? Many thanks. Sheets.Add ActiveWorkbook.PivotCaches.Create(SourceType:=xlDa tabase, SourceData:= _ "My Calcs!R1C1:R109C23", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="Sheet1!R3C1", TableName:="PivotTable6", DefaultVersion _ :=xlPivotTableVersion10 Sheets("Sheet1").Select Cells(3, 1).Select With ActiveSheet.PivotTables("PivotTable6").PivotFields ("Mgr E- mail") .Orientation = xlRowField .Position = 1 End With Range("A9").Select With ActiveSheet.PivotTables("PivotTable6") .ColumnGrand = False .RowGrand = False End With Range("A6").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy MsgBox "The Macro is paused until you paste the email addresses in an Outlook email. Click OK when complete" |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code that will rerun or refresh a pivot table (after new data ispasted into the original Pivot Table's Source Range) | Excel Programming | |||
Code for a Macro that allows a Pivot table to be repeatedly run (fora dynamic rows in a table, but static field names) | Excel Programming | |||
Pivot Table Question: SubTotals for 2 of 4 Pivot Tables in same worksheet | Excel Programming | |||
Pivot Table Question : If statment in Pivot Table?? | Excel Discussion (Misc queries) | |||
VBA Code for a pivot table to open database and to reference table current page | Excel Programming |