Shading Alternate Rows of Text (doesn't matter if rows are deleted!):
Return to List
One way to make your data legible is to apply cell shading to every other row in a
range. Excel's Conditional Formatting feature (available in Excel or later) makes
this a simple task.
1. Select the range that you want to format
2. Choose Format, Conditional Formatting
3. In the Conditional Formatting dialog box, select Formula Is from the drop-down list, and enter this formula:
=MOD(ROW(),2)=0.
NOTE: By CHANGING "ROW" TO "COLUMN" can achieve same effect on columns!
4. Click the Format button, select the Patterns tab, and specify a color for the shaded rows.
5. Click OK twice to return to your worksheet.
The best part is that the row shading is dynamic. You'll find that the row shading persists
even if you insert or delete rows within the original range.
' SUBPROCEDURES WHICH APPLY & REMOVE ALTERNATE SHADING
Public Sub ApplyConditionalFormatting()
Application.ScreenUpdating = False
Cells.Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)=0"
Selection.FormatConditions(1).Interior.ColorIndex = 35
Cells(1, 1).Select
Application.ScreenUpdating = True
End Sub
Public Sub RemoveConditionalFormatting()
Application.ScreenUpdating = False
Cells.Select
Selection.FormatConditions.Delete
Cells(1, 1).Select
Application.ScreenUpdating = True
End Sub