ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically run macros (https://www.excelbanter.com/excel-programming/363057-automatically-run-macros.html)

daddioja

Automatically run macros
 

I have just started with Macros. I have recorded a few and want them to
run when you select a specific worksheet tab. The macros do
calculations and paste the data from another worksheet. When a user
selects the tab for the "Bottom5" worksheet, I want the macros to run.
How do I make this happen? Thanks for any help.


--
daddioja
------------------------------------------------------------------------
daddioja's Profile: http://www.excelforum.com/member.php...o&userid=35024
View this thread: http://www.excelforum.com/showthread...hreadid=547630


bigwheel

Automatically run macros
 
If you right click on the required tab and select View Code, then put your
code into a specific sub routine such as:-

Private Sub Worksheet_Activate()
MsgBox "Hi"
End Sub

then each time you select that tab the code will execute.

"daddioja" wrote:


I have just started with Macros. I have recorded a few and want them to
run when you select a specific worksheet tab. The macros do
calculations and paste the data from another worksheet. When a user
selects the tab for the "Bottom5" worksheet, I want the macros to run.
How do I make this happen? Thanks for any help.


--
daddioja
------------------------------------------------------------------------
daddioja's Profile: http://www.excelforum.com/member.php...o&userid=35024
View this thread: http://www.excelforum.com/showthread...hreadid=547630



Paul Lautman

Automatically run macros
 
daddioja wrote:
I have just started with Macros. I have recorded a few and want them
to run when you select a specific worksheet tab. The macros do
calculations and paste the data from another worksheet. When a user
selects the tab for the "Bottom5" worksheet, I want the macros to run.
How do I make this happen? Thanks for any help.


Call them from the worksheet activate event:

Private Sub Worksheet_Activate()

End Sub



daddioja[_2_]

Automatically run macros
 

Thanks a lot for the advice. It was perfect.

Does anyone know any sites that provide tips on basic syntax for
writing? I want to sort, copy, paste, etc. Thanks again for any help.


--
daddioja
------------------------------------------------------------------------
daddioja's Profile: http://www.excelforum.com/member.php...o&userid=35024
View this thread: http://www.excelforum.com/showthread...hreadid=547630



All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com