MS Excel  Macro’s Design Samples

Macros are typically used to automate repetitive tasks. A macro is a series of commands and functions that you can initiate whenever you want to perform a particular task.

In our example we will:

1. create a macro for a home budget that shows us the revenues and expenses. We can re-use this structure on a monthly basis and add in our monthly income and expenses: The result we want is the spreadsheet shown below 

2. Assign a short-cut key (Ctrl+b) to this macro. By clicking ctrl+b the spreadsheet as shown below will show

Create the macro and assign short cut key:

a. Open a blank Excel spreadsheet

b. Click Tools: Macro: Record New Macro. The macro dialog box starts:

c. In Macro Name type: Budget

d. Assign short key: type "b"

e. In description box type: "This macro creates my home budget structure"

f. Click OK to start the macro

You will be returned to the spreadsheet and notice the macro recorder:

tart typing the information as shown above in the Home Budget figure: In column A all labels as shown and in column B the following formulas: type in
cell B7: =SUM(B4:B6)
cell B18 =SUM(B10:B17)
cell B20: =B7-B18. Click cell B4

i. Click the stop recording button

j. Delete all information you just typed

k. Press ctrl+b and all the information you typed earlier will show.

You can also go back to the menu bar and click Tools: Macro: Macro’s and you will see the following dialog box:

m. Click the run button to run (or start) the macro.

n. If you decide you do not want the macro anymore, make sure the macro Budget is selected and press the delete key

Back to Top