Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I've got a project where I've got hundreds of rows, the first several columns of which are highlighted [using conditional formatting] to light green or dark green, based on subsequent columns having data [shaded] or not having data [not shaded].
I'd like to, for each of the first columns, find a way to add a checkbox that would hide rows in that column that we're highlighted - like a loop from A2:A2000 - where it hides rows that don't have the light green coloring.
Thanks for all of the help.

AFAIK you can not use VBA to check the interior color of a cell that has been colored via Conditional Formatting.
One possible workaround is to use VBA to check the values of the cells that would cause the Conditional Formating to be in effect.
For example, if values in B2:B2000 which are > 0 would cause the corresponding cell in Column A to be Conditionally Formatted as Light Green, then this code would hide all rows that were not Light Green because it would hide all rows where the value in B2:B2000 was < = 0.
The main issue with this work around is that you have to keep your code and your Conditional Formatting in sync. Change the criteria for the CF (e.g. > 6) and you have to change the code to match.
Sub HideMyRows()
For Rw = 2 To 2000
If Cells(Rw, 2) <= 0 Then _
Cells(Rw, 2).EntireRow.Hidden = True
Next
End Sub

![]() |
outlook to entourage
|
Spell-check in Excel
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |