05 August 2011
Firstly go to tools menu: 1. Set the security level to Medium or Low. 1. On the Tools menu, click Options. 2. Click the Security tab. 3. Under Macro Security, click Macro Security. 4. Click the Security Level tab, and then select the security level you want to use. 2. On the Tools menu, point to Macro, and then click Record New Macro. 3. In the Macro name box, enter a name for the macro (macro: An action or a set of actions that you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.). Notes The first character of the macro name must be a letter. Other characters can be letters, numbers, or underscore characters. Spaces are not allowed in a macro name; an underscore character works well as a word separator. Do not use a macro name that is also a cell reference or you can get an error message that the macro name is not valid. 4. If you want to run the macro by pressing a keyboard shortcut key (shortcut key: A function key or key combination, such as F5 or CTRL+A, that you use to carry out a menu command. In contrast, an access key is a key combination, such as ALT+F, that moves the focus to a menu, command, or control.), enter a letter in the Shortcut key box. You can use CTRL+ letter (for lowercase letters) or CTRL+SHIFT+ letter (for uppercase letters), where letter is any letter key on the keyboard. The shortcut key letter you use cannot be a number or special character such as @ or #. NOTE The shortcut key will override any equivalent default Microsoft Excel shortcut keys while the workbook that contains the macro is open. 5. In the Store macro in box, click the location where you want to store the macro. If you want a macro to be available whenever you use Excel, select Personal Macro Workbook 6. If you want to include a description of the macro, type it in the Description box. 7. Click OK. 8. If you want the macro to run relative to the position of the active cell, record it using relative cell references. On the Stop Recording toolbar, click Relative Reference so that it is selected. Excel will continue to record macros with relative references until you quit Excel or until you click Relative Reference again, so that it is not selected. 9. Carry out the actions you want to record. 10. On the Stop Recording toolbar, click Stop Recording .