How do you get a macro to run whenever a worksheet is opened?
How do you get a macro to run whenever a worksheet is opened?
Darren,
Open the ThisWorkbook module and enter you code in the:
Private Sub Workbook_Open()
End Sub
NickHK
"DarrenG" <[email protected]> wrote in
message news:[email protected]...
>
> How do you get a macro to run whenever a worksheet is opened?
>
>
> --
> DarrenG
> ------------------------------------------------------------------------
> DarrenG's Profile:
http://www.excelforum.com/member.php...o&userid=36529
> View this thread: http://www.excelforum.com/showthread...hreadid=565060
>
Hi Darren,
Try:
'=============>>
Private Sub Workbook_Open()
Call MyMacro
End Sub
'<<=============
This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:
Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.
---
Regards,
Norman
"DarrenG" <[email protected]> wrote in
message news:[email protected]...
>
> How do you get a macro to run whenever a worksheet is opened?
>
>
> --
> DarrenG
> ------------------------------------------------------------------------
> DarrenG's Profile:
> http://www.excelforum.com/member.php...o&userid=36529
> View this thread: http://www.excelforum.com/showthread...hreadid=565060
>
Private Sub Worksheet_Activate()
'your code here
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"DarrenG" <[email protected]> wrote in
message news:[email protected]...
>
> How do you get a macro to run whenever a worksheet is opened?
>
>
> --
> DarrenG
> ------------------------------------------------------------------------
> DarrenG's Profile:
http://www.excelforum.com/member.php...o&userid=36529
> View this thread: http://www.excelforum.com/showthread...hreadid=565060
>
Hi Darren,
I misread your request.
If you mean worksheet, as stated, and not workbook, use the code suggested
by Bob.
---
Regards,
Norman
Perfect, thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks