Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How to auto activate macro when file opened
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 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How to auto activate macro when file opened
Thank you for your info, and now I have accomplished what I wanted for my
programming file. Bonzio "Otto Moehrbach" wrote: 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 |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How to auto activate macro when file opened
You're welcome and thanks for the feedback. Otto
"bonzio" wrote in message ... Thank you for your info, and now I have accomplished what I wanted for my programming file. Bonzio "Otto Moehrbach" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Weird File Open/Save As Behavior | Excel Discussion (Misc queries) | |||
macro save a workbook whilst increasing file no | Excel Worksheet Functions | |||
Open an Excel file with a date as today in a macro | Excel Discussion (Misc queries) | |||
file opened twice on network | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) |