Microsoft Excel Training Videos

A macro with a 'for' loop to calculate and format cells in Microsoft Excel

When using Visual Basic in Excel, you often need to run the same block of statements on each cell in a range of cells. To do this, you combine a looping statement and one or more methods to identify each cell, one at a time, and run the operation.
One way to loop through a range is to use the For...Next loop with the Cells property. Using the Cells property, you can substitute the loop counter (or other variables or expressions) for the cell index numbers. In the following example, the variable counter is substituted for the row index. The procedure loops through the range C2:C10, setting to bold any value that is greater than or equal to 18000. Now this process automates conditional formatting as shown in the training video!




Custom Search

Microsoft Excel Training Videos