Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default changing Pivot table name via macro

Hi,

I have around 20 pivot table in a excel file. One Pivot table on each
sheet. The data source of all the pivot tables is external.

I need to refresh these pivot tables on a daily basis for monitoring
daily changes.

I have kept the name of the Pivot table the same as the Sheet name for
simplicity. However whenever the Pivot tables are refreshed, the name
changes back to Pivottable**.

I would like to have a macro which can change back the Pivot table name
in each of the 20 sheets to the Sheet name after I finish refreshing
all the sheets.

Appreciate if some one can help me on this.

Regards
Sandip.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default changing Pivot table name via macro

to refresh Pivot Table you can try this command:

Sub AllWorkbookPivotsRefresh()
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets

ws.Activate
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt

Next ws

End Sub




"Sandip" wrote:

Hi,

I have around 20 pivot table in a excel file. One Pivot table on each
sheet. The data source of all the pivot tables is external.

I need to refresh these pivot tables on a daily basis for monitoring
daily changes.

I have kept the name of the Pivot table the same as the Sheet name for
simplicity. However whenever the Pivot tables are refreshed, the name
changes back to Pivottable**.

I would like to have a macro which can change back the Pivot table name
in each of the 20 sheets to the Sheet name after I finish refreshing
all the sheets.

Appreciate if some one can help me on this.

Regards
Sandip.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default changing Pivot table name via macro

Hi Muhammed,

I think you misread my query.

I have to refresh each table manually via an add-in as it accesses an
external source and each pivot table takes 3 to 10 min to refresh.

The macro I require is to rename each pivot name which automatically
changes to Pivottable**. The Pivot table name needs to be changed back
to the Sheet name.

I have certain macros and reports which filters Pivot fields and hence
accesses all the pivot table by their specific names. However the names
change upon refresh. Currently I go through each pivot table and rename
it with the same name as the sheet name after I finish refreshing all
the 20 pivots.

Regards
Sandip

Muhammed Rafeek M wrote:
to refresh Pivot Table you can try this command:

Sub AllWorkbookPivotsRefresh()
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets

ws.Activate
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt

Next ws

End Sub




"Sandip" wrote:

Hi,

I have around 20 pivot table in a excel file. One Pivot table on each
sheet. The data source of all the pivot tables is external.

I need to refresh these pivot tables on a daily basis for monitoring
daily changes.

I have kept the name of the Pivot table the same as the Sheet name for
simplicity. However whenever the Pivot tables are refreshed, the name
changes back to Pivottable**.

I would like to have a macro which can change back the Pivot table name
in each of the 20 sheets to the Sheet name after I finish refreshing
all the sheets.

Appreciate if some one can help me on this.

Regards
Sandip.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default changing Pivot table name via macro

Hi Sandip,

I have tested this, but a slight modification of the original code might
work as follows: -

Sub AllWorkbookPivotsRefresh()
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets

ws.Activate
For Each pt In ws.PivotTables
pt.name = ws.name
Next pt

Next ws
End Sub

i presume this would give you some kind of error if you have more than one
pivto table per sheet, but as you've said that you haven't... it might just
work! you might to include some sort of error handling for that and/or the
absence of a pivot table on any sheets.

hth,

tim



"Sandip" wrote in message
ps.com...
Hi Muhammed,

I think you misread my query.

I have to refresh each table manually via an add-in as it accesses an
external source and each pivot table takes 3 to 10 min to refresh.

The macro I require is to rename each pivot name which automatically
changes to Pivottable**. The Pivot table name needs to be changed back
to the Sheet name.

I have certain macros and reports which filters Pivot fields and hence
accesses all the pivot table by their specific names. However the names
change upon refresh. Currently I go through each pivot table and rename
it with the same name as the sheet name after I finish refreshing all
the 20 pivots.

Regards
Sandip

Muhammed Rafeek M wrote:
to refresh Pivot Table you can try this command:

Sub AllWorkbookPivotsRefresh()
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets

ws.Activate
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt

Next ws

End Sub




"Sandip" wrote:

Hi,

I have around 20 pivot table in a excel file. One Pivot table on each
sheet. The data source of all the pivot tables is external.

I need to refresh these pivot tables on a daily basis for monitoring
daily changes.

I have kept the name of the Pivot table the same as the Sheet name for
simplicity. However whenever the Pivot tables are refreshed, the name
changes back to Pivottable**.

I would like to have a macro which can change back the Pivot table name
in each of the 20 sheets to the Sheet name after I finish refreshing
all the sheets.

Appreciate if some one can help me on this.

Regards
Sandip.





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
Changing a pivot table page or data set by using a macro [email protected] Excel Programming 1 June 16th 05 01:01 AM
Changing pivot table views with a macro Roberto Hernandez Excel Programming 0 March 8th 05 04:45 PM
changing pivot table views with a macro Baileys Cigs Excel Programming 2 February 2nd 05 08:29 PM
Changing field in Pivot Table with macro hans Excel Programming 0 June 23rd 04 09:17 AM
macro, pivot table and changing number of rows Ali[_3_] Excel Programming 1 May 14th 04 04:15 PM


All times are GMT +1. The time now is 04:10 PM.

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

About Us

"It's about Microsoft Excel"