How to Write a Simple Macro in Microsoft Excel
Method 1 of 2: Excel 2007 and 2010
-
1
Click the Developer tab on the Ribbon at the top of the screen. If the tab is not showing up on your screen, you can add it as follows:
- For Excel 2010: click the File Tab then select options. On the left hand side of the Excel options dialog box, click Customize Ribbon. Then, on the right hand side box select Developer.
- For Excel 2007: click the Microsoft Office button, then Excel
Options. In the Popular category, under Top Options for Working with
Excel, select Show Developer Tab in Ribbon.
Ad
-
2
Change the security settings. In Trust Centre, Under Macro Settings, click Enable All Macros, then click OK.
- Note that this security setting is not ideal for basic use. When
you've finished creating your macro, go back and un-click Enable All
Macros.
-
3
Click Record Macro. You'll find it on the Developer tab under Code.
-
4
Name your macro. The
first character of the name must be a letter; after that, you can use
characters, numbers and underscores. Macro names cannot have spaces.
- Don't use the same name for your macro as an existing cell reference.
-
5
Set a shortcut for your macro (optional).
Type a letter in the Shortcut Key box. A lowercase letter will
translate to CTRL + letter; an uppercase letter will be CTRL + SHIFT +
letter.
-
6
Choose where to store your macro.
In the Store Macro In list, select the workbook where you want to store
the macro. If you want it to be available whenever you run Excel,
select Personal Macro Workbook.
-
7
Describe your macro. Write this in the Description box.
-
8
Click OK to start recording your macro.
-
9
Perform the actions you want the macro to record.
-
10
Stop recording. Go to the Developer tab, click Code, then click Stop Recording.
Method 2 of 2: Excel 2003
-
1
Change the security level. Switch the security level from Medium to Low.
- Click Tools -> Options -> Security.
- Click Macro Security.
- Select Security Level. Select Low.
-
2
Start recording your macro. Navigate to Tools -> Macro -> Record New Macro.
-
3
Name your macro. The character of the name must be a letter; after that, you can use symbols, numbers or underscores. No spaces are allowed.
- Don't use the same name for your macro as an existing cell reference.
-
4
Code a shortcut for your macro (optional).
Enter a letter in the Shortcut Key box. A lowercase letter will make
the shortcut CTRL + letter; uppercase will be CTRL + SHIFT + letter.
-
5
Choose where to store your macro. In the Store Macro box, select a location for your macro. Click Personal Macro Workbook if you want it to be available whenever you open Excel.
-
6
Write a description of your macro.
- When you're done, click OK.
-
7
Record your macro. Remember, Record Macro is still on. Carry out the actions that you want Excel to record as your macro.
-
8
Click Stop Recording. You can find this option on the Stop Recording toolbar.
No comments:
Post a Comment