MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel Macros

Posted by BASHYAM on July 04, 2001 4:17 AM

Is there any method of creating an auto macro like the one which exists in lotus 123.

The macro should execute automatically when the file is opened

Posted by Cory on July 04, 2001 6:52 AM

I've not used Lotus before, but I think I know what you're looking for. Go to View on your top menu bar then Toolbars --> Visual Basic. Click the round "Record" circle and perform whatever actions you want. Hit the square "Stop" button when you're done. You can run it by clicking the "Play" button, selecting your macro then choosing "Run". Or use the hotkey you assigned to it (if you did).

To run it automatically when you open the workbook do this:

Press "Play" to run the macro, but choose "Edit" instead of Run. Copy or cut the code you see then look in the column on the left for the list of workbook sheets. At the end of that list there's on called "This Workbook"; right-click on that and choose "View Code". At the top of the new window you'll see a dropdown arrow box that says (General) in it.. Drop that down and choose "Workbook" You'll see something like:

Private Sub Workbook_Open ()

End Sub

In between those two lines is where you paste your macro code. That code will execute every time you open the workbook.

Help any?