set your worksheet to it's own window (the one between minimize and exit) then right click in the bar at the top of the column letters then choose view code, in the left drop down, change (general) to "workbook" and in the next drop down choose "open"
Place your code or, a sub/function name (to call),here.
With your workbook open, hit Alt+F11 to open the VB editor
Ctrl+R will display the project explorer - in that, expand the 'Microsoft Excel Objects' folder in the project for your file [VBAProject(yourfilename)] and double-click 'This Workbook'
This should bring up the code window for the workbook_open event
Calling your marco from here will run it every time you open that workbook:
Private Sub Workbook_Open()
Call myMacro
End Sub
Note: The right combo box above the code window lists the other workbook events that you might want to use as well
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.