MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Automatic MAcros???


Posted by Rachel on September 16, 2001 8:37 AM


Can anyone help

I need to make a macro i ahve written run automatically when i open the workbook, but can't work out how!!


Posted by Tom Urtis on September 16, 2001 9:49 AM

Rachel,

You can either create a subroutine in the Workbook module, or create an Auto_Open procedure in a VB module. Either one works fine, my preference in most cases tends to be the latter option. If you are new to VB, here're the steps from start to finish:

Click on Tools > Macro > Visual Basic Editor, then Click Insert > Module > and where the cursor is flashing, type Sub Auto_Open and hit Enter. The space in between "Sub Auto_Open()" and "End Sub" is where you shall insert the code that will be triggered every time the file opens.

Hope this helps.

Tom Urtis

Posted by Rachel on September 16, 2001 10:05 AM

Thanks Tom

That works a treat.

Rachel