Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KB KB is offline
external usenet poster
 
Posts: 41
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Building pivot tables in Excel 2007 based on existing pivot tables? [email protected] Excel Discussion (Misc queries) 4 December 26th 07 08:05 PM
Issue with refreshing pivot tables in my code robs3131 Excel Programming 0 June 5th 07 05:44 AM
range names in pivot tables Forrest Excel Discussion (Misc queries) 0 January 10th 06 06:38 PM
Problems with updating category names in pivot tables Vladimir Excel Discussion (Misc queries) 2 November 3rd 05 12:54 PM
issue with pivot-tables AmyTaylor[_31_] Excel Programming 4 September 26th 05 08:10 PM


All times are GMT +1. The time now is 07:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"