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 click on different tab in Excel

Is there a way to set up a macro to run when you click on a different tab in
the Excel sheet? I have a data tab where I pull my data tab that I have set
up a macro to format some of the data in that pull. Would like that macro to
run when I click on the pivot tab. Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default Run Macro when click on different tab in Excel

Supe,

You can use the Worksheet_Activate event. Take a look at the Worksheet Object
Event section in the Help on VBA

Alan

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200907/1

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Run Macro when click on different tab in Excel

Copy/paste this to the pivot tab module.

Private Sub Worksheet_Activate()
macroname
End Sub


Gord Dibben MS Excel MVP

On Mon, 20 Jul 2009 14:36:02 -0700, Supe
wrote:

Is there a way to set up a macro to run when you click on a different tab in
the Excel sheet? I have a data tab where I pull my data tab that I have set
up a macro to format some of the data in that pull. Would like that macro to
run when I click on the pivot tab. Is this possible?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Run Macro when click on different tab in Excel

There are 5 Modules listed. I have two macros I want to activate:

findandreplace
FormatDate

Do I need to list each macro in a separate code? Which module would I put
it in? My findandreplace macro is in Module 3 and my FormatDate macro is in
Module 5.


"Gord Dibben" wrote:

Copy/paste this to the pivot tab module.

Private Sub Worksheet_Activate()
macroname
End Sub


Gord Dibben MS Excel MVP

On Mon, 20 Jul 2009 14:36:02 -0700, Supe
wrote:

Is there a way to set up a macro to run when you click on a different tab in
the Excel sheet? I have a data tab where I pull my data tab that I have set
up a macro to format some of the data in that pull. Would like that macro to
run when I click on the pivot tab. Is this possible?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Run Macro when click on different tab in Excel

Right-click on the Pivot Tab.

Select "View Code"

Copy/paste this code to the sheet module that opens.

Private Sub Worksheet_Activate()
findandreplace
FormatDate
End Sub

Leave the two macros where they are in the general modules.


Gord Dibben MS Excel MVP


On Wed, 22 Jul 2009 10:07:01 -0700, Supe
wrote:

There are 5 Modules listed. I have two macros I want to activate:

findandreplace
FormatDate

Do I need to list each macro in a separate code? Which module would I put
it in? My findandreplace macro is in Module 3 and my FormatDate macro is in
Module 5.


"Gord Dibben" wrote:

Copy/paste this to the pivot tab module.

Private Sub Worksheet_Activate()
macroname
End Sub


Gord Dibben MS Excel MVP

On Mon, 20 Jul 2009 14:36:02 -0700, Supe
wrote:

Is there a way to set up a macro to run when you click on a different tab in
the Excel sheet? I have a data tab where I pull my data tab that I have set
up a macro to format some of the data in that pull. Would like that macro to
run when I click on the pivot tab. Is this possible?




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
Click in cell to run macro alistew Excel Discussion (Misc queries) 7 February 20th 07 05:03 PM
Run Macro on Mouse Click vacation Excel Worksheet Functions 8 July 24th 06 04:10 PM
Disabling click and right-click on the Picture I inserted in an Excel document [email protected] Excel Worksheet Functions 1 June 2nd 06 09:13 PM
Run macro on double click only famdamly Excel Discussion (Misc queries) 2 February 27th 06 12:15 PM
Cannot assign a macro using right-click Cuyahogen Excel Discussion (Misc queries) 4 July 27th 05 03:56 PM


All times are GMT +1. The time now is 07:45 PM.

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"