Excel conditional formatting

Soldato
Joined
19 Jul 2005
Posts
7,069
Location
S. Yorkshire
I have a spreadsheet with thousands of rows, some of these rows have a green background.

Does anyone know an easy way to hide all cells that don't have a green background?

I'm guessing either a VBA macro or conditional formatting option should be the way forward, but I have skills in neither unfortunately.:(

cheers
 
I've found a macro that seems to do half the work, but it needs tweaking:
Sub colmac()
Dim cell As Range
For Each cell In Sheets("Translation sheet").Range("c1:c5000")
If cell.Interior.ColorIndex <> 35 Then
Rows("11:11").EntireRow.Hidden = True
Exit Sub
End If
Next cell
End Sub
Now this hides cell C11 as it conforms to the colour I have specified, but I need it to do this with every cell in that column (assuming it is the correct colour).

Can anyone help me fix this?

thanks
 
Code:
Sub tester()

Dim row As Integer
row = 5
While row <= 5000
    If Sheets("Translation sheet").Range("C" & row).Interior.ColorIndex <> 35 Then
       Sheets("Translation sheet").Range("C" & row).EntireRow.Hidden = True
    End If
    row = row + 1
Wend

End Sub

Loops through from C 5(row) to c5000 hiding each ROW that doesnt meet your colour condition.
 
Just tried that and it worked perfectly. You're a star and have saved me a huge amount of time! :)
 
Back
Top Bottom