Consulting | Excel Examples
Keywords: Formatting, Macro Recorder, Do Loop, With
Description: Use a VBA subroutine to shade selected cells on the worksheet. This example show how to add a Do Loop and With statement to a recorded macro.
Tip: You can modify recorded macros with Do Loop and With, End With to create Visual Basic for Applications procedures that perform an operation on a block of cells. Use the macro recorder to record the action of changing one cell, then modify the macro to loop through a selected range.With these Visual Basic for Applications Tools, you will be able to add power to your recorded Macros.
Guide to the Example: A copy of the recorded macro and step by step instructions for modifiying it are shown on the sheet "Visual Basic Example". Sheet1 and Module2 demonstrate the macro in use.
Download File: Click Here
Tip: Click on the link above and choose "Save" to download the xls workbook to your hard drive or "Open" to open the workbook inside of your browser.
The example workbook explains how to add loops to a recorded macro.