Select/hide rows according to interior colorindex

  • Thread starter Thread starter sdnicsm
  • Start date Start date
S

sdnicsm

I have a sheet with alt color rows with different rows of non-colore
rows spanning the sheet for hundreds of rows.
ex: rows,,purple..3white..purple..5white..purple..purple...8white

I would like to hide the non colored rows upon exe of macro.

As of late I have been manually selecting and hiding. There has to be
better way.

gf
 
Sub test()
Dim r As Range, c As Range
Application.ScreenUpdating = False
With ActiveSheet
Set r = .Range(.Range("A1"), _
..Range("A" & Rows.Count).End(xlUp))
r.EntireRow.Hidden = False
For Each c In r
If c.Interior.ColorIndex = xlNone Then _
c.EntireRow.Hidden = True
Next c
End With
Application.ScreenUpdating = True
End Sub

--
XL2002
Regards

William

(e-mail address removed)

| I have a sheet with alt color rows with different rows of non-colored
| rows spanning the sheet for hundreds of rows.
| ex: rows,,purple..3white..purple..5white..purple..purple...8white
|
| I would like to hide the non colored rows upon exe of macro.
|
| As of late I have been manually selecting and hiding. There has to be a
| better way.
|
| gfr
|
|
| ---
| Message posted
|
 
Beautiful...

Worked great. Had to take an extra period. but just wonderful!!!

..Range("A" & Rows.....

.Range("A" & Rows.....


Thanks a millio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top