how do you colour alternate visible rows only

  • Thread starter Thread starter mlynch
  • Start date Start date
try this

Sub colorvisiblerows()
x = Range("a" & Rows.Count).End(xlUp)
Rows("1:" & x).Interior.ColorIndex = xlNone
For i = 2 To x Step 2
Cells(i, 1).SpecialCells(xlCellTypeVisible) _
.EntireRow.Interior.ColorIndex = 6
Next i
End Sub
 
Don Guillett wrote
Sub colorvisiblerows()
x = Range("a" & Rows.Count).End(xlUp)
Rows("1:" & x).Interior.ColorIndex = xlNone
For i = 2 To x Step 2
Cells(i, 1).SpecialCells(xlCellTypeVisible) _
.EntireRow.Interior.ColorIndex = 6
Next i
End Sub

I was interested in this routine as well, but keep getting a 'Type
mismatch' error in this line:

Rows("1:" & x).Interior.ColorIndex = xlNone
 
David Turner wrote
Don Guillett wrote


I was interested in this routine as well, but keep getting a 'Type
mismatch' error in this line:

Rows("1:" & x).Interior.ColorIndex = xlNone

Never mind. Changed first line to

x = Range("a" & Rows.Count).End(xlUp).Row

and now it works
 
Back
Top