Record a Macro

Record a macro is the simplest way to enhance the power of excel. And you do not have to know programming to make use of macros to enhance the your productivity. In this example, we are going to share with you how you can record a macro that will format the cell with a number format that is not provided by any of the Excel icons. To make it complete, we need to create an icon and assign the macro to the icon, First let us show you how to record the macro and save it such that you can use it in all the worksheets.

  1. Enter a number in the active cell. Make sure this cell is selected before you record the macro.
  2. Go to the menu, click on Tools --> Macro --> Record New Macro.
  3. Enter a name for the macro e.g. Custom_Num_Format (note: spaces are not allowed), select to store the macro in "Personal Macro Workbook".
  4. Once macro recording starts, try not to touch the worksheet. If you accidentally select a cell in the porcess, the action will be captured and the macro will always include this action of selecting the cell.
  5. Go to the menu bar and select Format -> Cells.
  6. In the Format Cell window, select the Number Tab.
  7. Select the number category, check the box "Use 1000 Separator (,)", select the negative number format with bracket. In this step, you can choose your own number formatting.
  8. Go to the Patterns Tab and select the color RED to colour the selected cell. You can choose to skip this step if you do not want format the cell RED.
  9. Click OK to exit Format Cell Dialog box.
  10. Stop the Macro Recorder by click on the pop up box. ALTernatively, goto to menu, click on Tools --> Macro --> Stop Recording.
  11. Close the Excel Application. You can click on the big RED X on the top right hand corner. There will be a number of prompts depending on how many worksheets are opened. Look out for the prompt on whether you want to save the changes made to the personal macro workbook. Click Yes. This will save the macro and make it available for use every time you open Excel.

After you record the macro, you can try running the macro.

New! Comments

Have your say about what you just read! Leave me a comment in the box below.