View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default run a macro when file is open

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

"nabil" wrote:

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