ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open Worksheet (https://www.excelbanter.com/excel-programming/368371-open-worksheet.html)

DarrenG[_6_]

Open Worksheet
 

How do you get a macro to run whenever a worksheet is opened

--
Darren
-----------------------------------------------------------------------
DarrenG's Profile: http://www.excelforum.com/member.php...fo&userid=3652
View this thread: http://www.excelforum.com/showthread.php?threadid=56506


NickHK

Open Worksheet
 
Darren,
Open the ThisWorkbook module and enter you code in the:
Private Sub Workbook_Open()

End Sub

NickHK

"DarrenG" wrote in
message ...

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




Norman Jones

Open Worksheet
 
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" wrote in
message ...

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




Bob Phillips

Open Worksheet
 
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" wrote in
message ...

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




Norman Jones

Open Worksheet
 
Hi Darren,

I misread your request.

If you mean worksheet, as stated, and not workbook, use the code suggested
by Bob.

---
Regards,
Norman



DarrenG[_7_]

Open Worksheet
 

:) Perfect, thanks. :

--
Darren
-----------------------------------------------------------------------
DarrenG's Profile: http://www.excelforum.com/member.php...fo&userid=3652
View this thread: http://www.excelforum.com/showthread.php?threadid=56506



All times are GMT +1. The time now is 04:05 AM.

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