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? |
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 |
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? |
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? |
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? |
All times are GMT +1. The time now is 03:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com