Run a macro when opening a spreadsheet

  • Thread starter Thread starter Guest
  • Start date Start date
Hi Duncan,

In the workbook's ThisWorkbook Module, insert a

Sub workbook_open()
'Your code
End Sub

macro. To access this module, right-click the Excel icon to the left of
"File" on th menu bar, select "View Code".

Alternatively, in a general module, insert a

Sub Auto_Open
'Your Code
End Sub

macro.

If you are unfamiliar with macros, see David McRitchie's Getting Started
with Macros and User Defined Functions notes at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Norman Jones said:
To access this module, right-click the Excel icon to the left of
"File" on th menu bar, select "View Code".

This is true if you have your spreadsheet maximized, but if you don't as in
my case, the icon is at the top-left of the spreadsheet, not by the File
menu.
 
Been there Norman. I think it was Gord Dibben that corrected me :-)

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top