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".
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.
4. Go to the menu bar and select Format -> Cells.
5. In the Format Cell window, select the Number Tab.
6. 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.
7. 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.
8. Click OK to exit Format Cell Dialog box.
9. Stop the Macro Recorder by click on the pop up box. Alternatively, goto to menu, click on Tools --> Macro --> Stop Recording.
10. 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.
Share this page:
Would you prefer to share this page with others by linking to it?
Microsoft® and Microsoft Excel® are registered trademarks of Microsoft Corporation.
advanced-excel.com is in no way associated with Microsoft