run a macro when file is open

G

Guest

any one out there knows how to run a macro automatically in a workbook when
the workbook is open. I do not want the user to go to tools,macro,choose a
name and run the macro, what I am looking for is a way to run the macro
automatically. any one knows of a way to do this???? your comment is
appreciated
 
G

Guest

On your spreadsheet in the upper left corner is the excel logo. Right click
it and select view code. This will open up the VB screen and you will be in
the ThisWorkbook object. Just above the Code window you will see a drop down
with the word General in it. Change that to Workbook. At this point it should
create some code in the Code window that looks like

Private Sub Workbook_Open()

End Sub

This procedure will fire when the workbook is opened so just call your
procedure from here like this

Private Sub Workbook_Open()
Call MyProcedure
End Sub

HTH
 
G

Guest

thank you jim, your answer was helpful. would you be willing to provide me
with an email I would like to keep it in my inbox. thanks
 
G

Guest

Post to the Forum. I am here most of the time...

nabil said:
thank you jim, your answer was helpful. would you be willing to provide me
with an email I would like to keep it in my inbox. thanks
 

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