Autorun macro on opening spreadsheet

S

simonjackson79

I just wanted to know how to setup a macro to run as soon as the
spreadsheet is open. Can anyone help me with this?

Many thanks.
 
T

Tom Ogilvy

go into the VBE (alt+F11) and in the project explorer on the left, select
ThisWorkbook entry under you workbook/project. Double click on it to get
the ThisWorkbook Module displayed. In this module at the top, in the left
dropdown, select Workbook and in the right dropdown, select Open. This will
put in the declaration for the workbook_Open event which fires when the
workbook is opened

Private Sub Workbook_Open()

End Sub

put your code or a call to your code in the above declaration.
 
A

Alan Webb

Refer to the macro you want to run in the Workbook_Open section of
ThisWorkbook in Microsoft Excel Objects
 

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

Top