Microsoft Excel

Only available on StudyMode
  • Download(s) : 1587
  • Published : June 15, 2011
Open Document
Text Preview
Microsoft Excel 2007: Create a macro by using Microsoft Visual Basic |   Add to Favorites     |

In Microsoft Excel 2007, macros can be created using Microsoft Visual Basic.  The following will show you how to create a macro using Microsoft Visual Basic:

1. If the Developer tab is unavailable, complete the following to display it:           a. Click the Microsoft Office Button, and then click Excel Options.           b. In the Popular category, under Top options for working with Excel, choose the Show Developer tab in the Ribbon check box, and then click OK.

2. To set the security level temporarily to enable all macros, complete the following instructions:            a. On the Developer tab, in the Code group, click Macro Security.

          b. Under Macro Settings, click Enable all macros (not recommended, potentially dangerous code can run), and then click OK. 

Note: To help prevent dangerous code from running, it is recommend that you return to any of the settings that disable all macros after you are finished working with macros.

3. On the Developer tab, in the Code group, click Visual Basic. 

4. If needed, on the Insert menu, click Module.

Note: Modules are automatically created for all sheets in the workbook.

5. In the code window of the module, type or copy the macro code that you want to use.  6. To run the macro from the module window, press F5. 
7. On the File menu, click Close and Return to Microsoft Excel when you finish writing the macro. 

Microsoft Excel 2007: Assign a macro to an object, graphic, or control |   Add to Favorites     |

There are many new features available in Microsoft Excel 2007.  One of the neat things you can do in it is assign a macro to an object, graphic, or control.  The following will show you how to do it.

1. On a worksheet, right-click the object, graphic, or control to which you want to assign an existing macro, and then click Assign Macro on the shortcut menu.

 

2. In the Macro name box, click the macro that you want to assign.

Microsoft Excel 2007: Copy part of a macro to create another macro |   Add to Favorites     |

With Microsoft Excel you can copy part of a macro to create another one.

1. If the Developer tab is unavailable, follow the instructions below to display it:         a. Click the Microsoft Office Button, and then click Excel Options.

        b. In the Popular category, under Top options for working with Excel, select the Show Developer tab in the Ribbon check box, and then click OK.

2. To set the security level temporarily to enable all macros, follow the instructions below:          a. On the Developer tab, in the Code group, click Macro Security.

        b. Under Macro Settings, click Enable all macros (not recommended, potentially dangerous code can run), and then click OK. 

Note: To help prevent dangerous code from running, it is recommend that you return to any of the settings that disable all macros after you finish working with macros.

3. Open the workbook that contains the macro that you want to copy. 

4. On the Developer tab, in the Code group, click Macros. 

5. In the Macro name box, click the name of the macro that you want to copy. 

6. Click Edit.
 
7. In the code window of the Visual Basic Editor, select the lines of the macro that you want to copy. 

Note: To copy the entire macro, include the Sub and End Sub lines in the selection.

8. On the Edit menu, click Copy. Note: You can also right-click and then click Copy on the shortcut menu, or you can press CTRL+C.

9. In the Procedure box of the code window, click the module where you want to place the code. 

10. On the Edit menu, click Paste.

Note: You can also right-click and then click Paste on the shortcut menu, or you can press CTRL+V. You cannot edit your Personal Macro Workbook file (Personal.xlsb) because it is a hidden workbook that is always open. You must first unhide it by using the Unhide command....
tracking img