Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Recording a Macro

Adding a Little Animation to Your Life

Converting a Range of URLs to Hyperlinks

Making the Formula Bar Persistent

Engineering Calculations

Digital Signatures for Macros

Fixing the Decimal Point

 

Shading Rows for Ease in Reading Output

Summary: Shading every second, third, or fifth row of a printout can be helpful for reading data. This tip describes how to use a macro to get the formatting you desire. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

Those who have been around computers long enough may remember the days of green-bar paper. That's not to slight any places that may still be using green-bar; its just that the hey-day of such paper seems to be past. The need for such paper, particularly when dealing with numeric printouts, is still present however.

What green-bar paper did (for those who don't know) was provide a visual cue for your eyes so that you could easily follow a row of numbers across the width of the paper, without the human tendency of skipping from one row to another. You may still use some device to help you read rows of numbers--for instance, a ruler held under the row to guide your eyes.

If you find yourself pulling out the ruler more often or wishing for the return of green-bar paper, then you may be interested in a little macro I whipped up to help. The following macro, ShadeRows, will shade every fifth row in the rows you select. This means that the first, sixth, eleventh, and so on rows will be shaded.

Sub ShadeRows()
    Dim iStart As Integer
    Dim iEnd As Integer
    Dim iStep As Integer, J As Integer

    iStep = 5         'Shade every 5th row
    Application.ScreenUpdating = False
    iStart = 1
    iEnd = Selection.Rows.Count

    For J = iStart To iEnd Step iStep
        With Selection.Rows(J).Interior
            .ColorIndex = 15
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
        End With
    Next J
    Application.ScreenUpdating = True
End Sub

To run the macro, just select the rows you want to affect, and then run it. If you want to change the interval at which rows are shaded, change the iStep value from 5 to some other value. For instance, if you wanted every other row shaded, you would change iStep = 5 to iStep = 2.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2130) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003

Got the Time? Understanding the ins and outs of working with times and dates can be confusing. Remove the confusion--ExcelTips: Times and Dates is an invaluable resource for learning how best to work with times and dates.
 
Check out ExcelTips: Times and Dates today!