View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default How to auto activate macro when file opened

If you want the macro to run only when the file is opened, you can put the
code in a Workbook_Open event macro.
You can accomplish the same thing by putting the macro in a regular module
and naming the macro Auto_Open.
However, if you want the macro to run when the file is opened AND also when
you press a key combination, then you need the above Auto_Open macro in a
regular module.
To make the macro run from a key combination, go back to your
spreadsheet on the screen. Click on Tools - Macro - Macros and you will see
a list of all macros in all open workbooks. Select This Workbook to see
only those macros in the active workbook. Find the Auto_Open macro. Click
once on that macro, then click on Options. There you will see "Ctrl" and a
blank box. Hold down the Shift key and press the letter key of your choice,
say K. Now when you hold down both the Ctrl and Shift keys and press K, the
macro will run.
Please post back if you need more. HTH Otto
"bonzio" wrote in message
...
I have created a macro in the visual basic editor of my excel file, but I
don't know how to auto activate the macro whenever this file is opened or
when "Shift" &":" buttons are pressed. Can someone teach me how to make
this
happen.
Thank you.

Bonzio