SECTION 3
Lesson 3.1: Creating Macros in Excel

   

 

 

In this exercise, you will record a macro with an assigned shortcut that will automatically open and arrange workbook windows.

 

1.

To begin, start Excel and open the file named Practice 11 in your Excel 2003 Practice folder.

File->Open.

 

In a workbook with a lot of data, you may want to use more than one window to get a better picture of what is going on. To make opening and arranging multiple windows a little more efficient, you will create a macro to perform the tasks of opening a new window, and arranging all available windows vertically.

 

 

2.

 Choose Tools->Macro->Record New Macro from the menu bar.

 

This will invoke the Record Macro dialogue box.

 

 

 

 

 

 

 

 

In the Record Macro Dialogue box, type DoubleWindow in the Macro name field (don’t put a space between words).

 

 

Next, type the letter d in the Shortcut key field (you can move between fields with a mouse click or by pressing the tab button).

 

Select This Workbook as the place to store your macro, because this macro is intended for use only with this workbook.

 

Finally, type This macro creates two windows for the same workbook in the Description box.

 

When you are satisfied with your entries click OK to start recording.

 

(It is advisable to practice the actions that the macro will carry out first, before you actually record the macro.)

 

 

 

3.

When you see the word Recording in the status bar, you know that any actions you perform are being recorded.

 

The first action is to choose Window->New Window from the menu bar.

 

This will create a new window for this workbook.

 

Though there may be no apparent difference in the Excel screen, another window for the same workbook is available.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(Notice that there are two window buttons available for the workbook on the desktop taskbar)

 

 

4.

The next step in recording your macro is to choose Window->Arrange from the menu bar.

 

This will display the Arrange Windows dialogue box

 

Click the Vertical radio button and make sure the Windows of active workbook box is checked. Click OK when you are finished.

 

 

 

 

 

 

 

 

 

 

Your Excel screen should look something like this. Choose Tools->Macro->Stop Recording to finish the macro.

 

 

5.

Now that you have created the macro, close the window named Practice 11:2 by clicking the x in the upper right corner of the window.

 

 

Expand the Practice 11:1 window to fill the Excel screen, And try your new macro by pressing Ctrl + d.

 

 

6.

You should see two vertically arranged windows for the same workbook on the screen. If you press Ctrl + d again you will see 3 vertical windows. Each time you use the shortcut key for your macro, you will add another window.

 

Save your work and exit Excel.