Shading Rows for Ease in Reading Output

by Allen Wyatt
(last updated December 11, 2011)

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 , 8, , 10, and .

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Preventing Styles from Changing

It is frustrating to spend a lot of time working on a document, getting your styles just right, and then have those styles ...

Discover More

Returning Least-Significant Digits

Do you ever have a need to return just a few digits out of a number? This tip shows different formulas you can use to return ...

Discover More

Full-Screen Mode in Word 2007

Full-screen mode in Word 2007 doesn't work exactly the same as it did in earlier versions of Word. Don't fret; the ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!


Hiding Errors on Printouts

If there are error values in a worksheet, you may not want those error values to appear on a printout. Excel actually allows ...

Discover More

Selecting a Paper Source

When you print a worksheet, you may want to specify that the printout be done on a particular paper tray in a particular ...

Discover More

Changing Orientations within a Single Printout

Excel allows you to print out information in either portrait or landscape orientation, but what if you need both types of ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)