It is not difficult to create a macro in Excel. The first step is to choose Tools->Macro->Record new Macro from the menu bar.
This will display the Record Macro dialogue box.
Here you can give your new macro a name (do not put spaces in the name), and choose where it should be stored (your options are to store it with this workbook, another workbook, or a special macro workbook). You can also enter a brief description of the macro you are about to create in the bottom text area. By default, the macro will be called Macro1 (if there are no other macros present), and it will be saved in the current workbook.
If you click OK, you will see a recording message at the lower left corner of the Excel screen in the status bar. You should also see the stop recording toolbar appear on your screen.
When you see the recording message, every keystroke or Excel action that you take with the mouse will be translated into VBA code by Excel. This code is what makes up your macro.
When you are finished performing the actions or keystrokes you wanted to record, you can stop recording by choosing Tools->Macro->Stop Recording, or by clicking the stop button on the stop recording toolbar.
If you click the relative reference button on the stop recording toolbar, the references used in the macro will be treated as relative references. This means that actions performed by the macro will be relative to the active cell when you start the macro. If you record with absolute references, the actions performed by the macro will be on the same cells regardless of the location of the starting cell. By default, macros employ absolute referencing whenever you open Excel.
If you want your macros to be accessible to all your worksheets, choose Personal Macro Workbook from the Store macro in drop list, in the Record Macro dialogue box.
When you close Excel, You will get this alert message if you have saved a macro to the personal macro workbook.
|