As I mentioned, random rows (dependent on user filtering) are hidden
by the code: Rows(ActiveCell.Row).Hidden = True
That is not filtering, and you did not mention it quite that way
before. What have are hidden rows (basically zero height).
You would first have the macro remove the interior color from
all rows then since you would not want the top row colored, you
can start from the top and work on the non hidden rows.
Option Explicit
Sub Band_alternate_35()
'David McRitchie, programming, 2004-01-12
'Color Band alternate rows not hidden by user
'-- as in .... Rows(ActiveCell.Row).Hidden = True
'-- not for use on filtered rows
'almost 5 minutes to do 20000 rows
Dim i As Long, nothidden As Boolean
i = ActiveSheet.UsedRange.Rows.Count '-- fix usedrange
Cells.Interior.ColorIndex = xlNone
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = 1 To Cells.SpecialCells(xlLastCell).Row
If Not Rows(i).hidden Then
nothidden = nothidden + 1
If Not nothidden Then Rows(i).Interior.ColorIndex = 35
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
"NorTor" wrote in message ...
As I mentioned, random rows (dependent on user filtering) are hidden
by the code: Rows(ActiveCell.Row).Hidden = True
And I want the banding to count only the rows that are visible after
the user has done the filtering, in a way that every second row is
colored and the ones in between are un-colored.