Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Issue building pivot tables with certain names
Hi
I have reports that build pivot tables based on a variable lifted from the name of the tab/sheet so that I can ensure the right regional data appears on the correct sheet. This code has been running problem free for over 6 months but we recently changed the names of the regions and I now have a problem - the new regional names are based on a series e.g. C01B and this seems to make the code fail. If I prefix the name to SC01B the pivot table is built but starting on the wrong sheet. Has anyone experienced something similar? Can you tell me what is going on? The code I am using is: Dim pc As PivotCache Dim pt As PivotTable Dim pi As PivotItem Dim val2 As String * 11, sht As String * 9 Dim dte1 As Date val2 = val1 & "_Pivot1" 'name of the pivot table sht = val1 & "!R7C5" 'destination of the pivot table Sheets(val1).Select ' inserts a pivot table Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=rng) Set pt = pc.CreatePivotTable(sht, val2) .....it breaks at the last line Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Building pivot tables in Excel 2007 based on existing pivot tables? | Excel Discussion (Misc queries) | |||
Issue with refreshing pivot tables in my code | Excel Programming | |||
range names in pivot tables | Excel Discussion (Misc queries) | |||
Problems with updating category names in pivot tables | Excel Discussion (Misc queries) | |||
issue with pivot-tables | Excel Programming |