![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello folks
Does anyone how to run the macro automatically? For example once I have recorded the macro, how can I set up the macro. So when the file can run the macro automatically when it is loaded to the excel? |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
To run it automatically on opening the workbook, go into the VBA editor, double-click on the ThisWorkbook entry in the Project Explorer pane and change the left-hand dropdown in the right pane from General to Workbook. This will create the Private Sub Workbook_Open() sub for you. Type in Call and the name of your macro (eg if your macro was called MyMacro, the code would look like this: -
Private Sub Workbook_Open() Call MyMacro End Sub HTH. [ This Message was edited by: Mudface on 2002-03-01 05:50 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|