

Step 3: In the shortcut key text box enter a capital "s" "SHIFT/s" and then click "OK". A new dialog window "Macro Options" appears: Step 2: "Sheet1.proFirst" being selected in the list box and its name appearing in the text box above the list box just click on "Options". In this second first exercise on events we will get the macro to be keyboard activated by capital "s" (Shift/S).

You now see that colleagues must have installed VBA on their own computer to be able to use your macros from the "Developer" ribbon. Step 3: Erase the contents of cells A1, A2 and A3 Step 2: "Sheet1.proFirst" being selected in the list box and its name appearing in the text box above the list box just click "Run". You will see the "Macro" dialog window below. Step 1: Select "Macros" from the "Developer" ribbon.
#Excel vba on open workbook event code#
To complete the following exercises, copy paste the code below from your browser to the code window of "Sheet1" of the new Excel workbook as you have learned in previous lessons.Įnd Sub Macros Triggered from the Developer Ribbon On a selected keystroke or going to the right menu item in Excel.
#Excel vba on open workbook event manual#
The event can also be: opening the workbook, selecting a sheet, the value of a cell changing due to a manual input or due to the recalculation of a formula, clicking The button can be on the worksheet or on a userform that you would develop. The event that is mostly (85%) of macros used is clicking on a button. A lot of other events can happen to start a macro. You do not want your user to go to the Visual Basic Editor to trigger a macro. You have also clicked on the F8 key at the top of your keyboard and the macro got executed line by line. In the Visual Basic Editor you have gone to the menu bar and clicked on "Run/Run Sub/Userform" and the macro was executed. In earlier lessons you have used an event to start your macros. When does the VBA procedure (macro) start? When an EVENT happens. Use ALT/F11 to open the Visual Basic Editor as you learned in lesson 1. Note 2: Print this page, open Excel and a open a new workbook.

Note 1: If you are using Excel 1997 to 2006 see lesson 9 here Here is a sample of what you will find in the downloadable Tutorial on Excel macros Starting, triggering a Macro in Excel
