Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Run Macro when changing tabs

I have a pivot table set up that runs off data from a different tabe in the
same workbook. The data will be refreshed monthly and some formatting needs
to be done to the data before refreshing the pivot table. I have set up a
macro that will do the formatting. Is there a way where the macro would run
as soon as you click on the tab for the pivot table?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Run Macro when changing tabs

In the PT sheet module

Private Sub Worksheet_Activate()

macroname(which will include references to the data sheet)

End Sub


Gord Dibben MS Excel MVP

On Wed, 31 Dec 2008 12:26:09 -0800, Supe
wrote:

I have a pivot table set up that runs off data from a different tabe in the
same workbook. The data will be refreshed monthly and some formatting needs
to be done to the data before refreshing the pivot table. I have set up a
macro that will do the formatting. Is there a way where the macro would run
as soon as you click on the tab for the pivot table?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Run Macro when changing tabs

Hi,

You can also run the macro when refreshing the pivot table:

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
'your code here
End Sub

I only point this out as info, I think it sounds better to use the sheet
activate routine.

This goes into the Sheet object for the pivot table sheet in the VBA
editior, just like the one provided by Gord.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Supe" wrote:

I have a pivot table set up that runs off data from a different tabe in the
same workbook. The data will be refreshed monthly and some formatting needs
to be done to the data before refreshing the pivot table. I have set up a
macro that will do the formatting. Is there a way where the macro would run
as soon as you click on the tab for the pivot table?

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 Excell Sheet Tabs to Different Colors Amy Excel Discussion (Misc queries) 4 March 8th 07 11:19 PM
Changing the size of sheetname tabs Edward Excel Discussion (Misc queries) 7 October 10th 06 02:27 AM
Changing the appearance of the cursor/pointer & size of tabs bjd1109 Excel Discussion (Misc queries) 0 February 7th 06 05:51 PM
Changing Tabs to Specific Cells Darren Excel Discussion (Misc queries) 2 November 10th 05 04:21 AM
Changing colors of tabs Christopher Anderson Excel Discussion (Misc queries) 2 November 29th 04 04:09 PM


All times are GMT +1. The time now is 08:52 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"