IT tutorials
 
Office
 

Microsoft Excel 2010 : Enabling and Examining Macros (part 2) - Examining Macros

- Windows 10 Product Activation Keys Free 2019
- How to active Windows 8 without product key
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
4/12/2014 9:06:01 PM

Examining Macros

The best way to get an idea of how macros work is to examine an existing macro. To do that, display the View tab. In the Macros group, click the Macros button, and then click View Macros.

Tip

In the Macro dialog box, you can display the macros available in other workbooks by clicking the Macros In box and selecting a workbook by name or selecting All Open Workbooks to display every macro in any open workbook. If you select either of those choices, the macro names that are displayed include the name of the workbook in which the macro is stored. Clicking This Workbook displays the macros in the active workbook.

The Macro dialog box displays a list of macros in your workbook. To view the code behind a macro, you click the macro’s name and then click Edit to open the Visual Basic Editor.

Tip

Keyboard Shortcut

You can also open and close the Visual Basic Editor by pressing Alt+F11.

Excel macros are recorded by using VBA. Consider, for example, the code for a macro that selects the cell range C4:C9 and changes the cells’ formatting to bold. The first line of the macro identifies the cell range to be selected (in this case, cells C4:C9). After the macro selects the cells, the next line of the macro changes the formatting of the selected cells to bold, which has the same result as clicking a cell and then clicking the Bold button in the Font group on the Home tab.

To see how the macro works, you can open the Macro dialog box, click the name of the macro you want to examine, and then click Step Into. The Visual Basic Editor opens, with a highlight around the instruction that will be executed next.

See Also

To execute an instruction, press F8. The highlight moves to the next instruction, and your worksheet then changes to reflect the action that resulted from executing the preceding instruction.

You can run a macro without stopping after each instruction by opening the Macro dialog box, clicking the macro to run, and then clicking Run. You’ll usually run the macro this way; after all, the point of using macros is to save time.

In this exercise, you’ll examine a macro in the Visual Basic Editor, move through the first part of the macro one step at a time, and then run the entire macro without stopping.

Set Up

Start Excel, open the VolumeHighlights_start workbook, click the Enable Content button on the Message Bar (if necessary), and save the workbook as VolumeHighlights. Then follow the steps.

  1. On the View tab, in the Macros group, click the Macros arrow and then, in the list that appears, click View Macros.

    Set Up

    The Macro dialog box opens.

    Set Up
  2. Click the HighlightSouthern macro, and then, to display the macro code, click Edit.

    The Visual Basic Editor opens, with the code for the HighlightSouthern macro displayed in the Module1 (Code) window.

  3. In the Visual Basic Editor window, click the Close button.

    Set Up

    The Visual Basic Editor closes, and Excel displays the VolumeHighlights workbook.

  4. In the Macros list, click View Macros.

    The Macro dialog box opens.

  5. Click the HighlightSouthern macro, and then click Step Into.

    The macro appears in the Visual Basic Editor, with the first macro instruction highlighted.

  6. Press the F8 key.

    Excel highlights the next instruction.

  7. Press F8 again.

    The macro selects the Atlantic row in the table.

  8. Press F8 twice.

    The macro changes the Atlantic row’s text color to red.

    Set Up
  9. Click the Visual Basic Editor Close button.

    A warning dialog box opens, indicating that closing the Visual Basic Editor will stop the debugger.

  10. Click OK.

    The Visual Basic Editor closes.

  11. In the Macros list, click View Macros.

    The Macro dialog box opens.

  12. Click the HighlightSouthern macro.

  13. Click Run.

    The Macro dialog box closes, and Excel runs the entire macro.

    Set Up
  14. On the Quick Access Toolbar, click the Save button.

    Set Up

Excel saves your work.

Clean Up

Close the VolumeHighlights workbook.

 
Others
 
- Microsoft Excel 2010 : Enabling and Examining Macros (part 1) - Macro Security in Excel 2010
- Microsoft Project 2010 : Maintaining Baselines (part 3) - Resetting a Baseline , Multiple Baselines
- Microsoft Project 2010 : Maintaining Baselines (part 2) - Rolling-Wave Planning with Baselines
- Microsoft Project 2010 : Maintaining Baselines (part 1) - Clearing a Baseline
- Microsoft Project 2010 : Viewing Baselines (part 2) - Formatting the Gantt Chart to Display the Baseline
- Microsoft Project 2010 : Viewing Baselines (part 1) - Tracking Gantt View and the Variance Table
- Microsoft Project 2010 : Understanding and Setting Baselines
- Microsoft Project 2010 : Strategic Importance of Project 2010
- Microsoft PowerPoint 2010 : Animating a SmartArt Graphic (part 2) - Apply a Customized Animation to a SmartArt Graphic, Reverse the Order of a SmartArt Graphic Animation
- Microsoft PowerPoint 2010 : Animating a SmartArt Graphic (part 1) - Animate a SmartArt Graphic
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS