View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Banding - visible rows only?

Look good!

You don't need Cells(1, 1).Activate

If you mean to do the whole row, then instead of: Range("A"
.... ).Interior...
try: Rows(j).Interior....

Here's my version:

Sub testit()
Dim i As Long, lngLastRow As Long

With Sheet1
lngLastRow = .Cells(1, 1).End(xlDown).Row
For i = 2 To lngLastRow Step 2
.Rows(i).Interior.ColorIndex = 35
Next
End With
End Sub

Rob



"NorTor" wrote in message
...
Hello,

I am filtering roughly 500 rows of data, and depending on the user's
choice, some rows are hidden.

For appearances, I like to do a banding of the data. Normally I would
use VBA like the following:

Cells(1, 1).Activate
j = 2
Do Until IsEmpty(Cells(j, 1))
Range("A" & j & ":" & "W" & j).Interior.ColorIndex = 40
j = j + 2
Loop

I hide the rows filtered using this code:

Rows(ActiveCell.Row).Hidden = True


All replies very much appreciated!



Best regards,
-NorTor