Computing.Net > Forums > Office Software > Checkbox - Hide Nonhighlighted rows

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Checkbox - Hide Nonhighlighted rows

Reply to Message Icon

Name: 24HG_Hoop
Date: May 29, 2008 at 15:14:42 Pacific
OS: xp pro
CPU/Ram: 2800 / 2G
Product: clone
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: May 30, 2008 at 21:38:10 Pacific
Reply:

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



0
Reply to Message Icon

Related Posts

See More


outlook to entourage Spell-check in Excel



Post Locked

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


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Checkbox - Hide Nonhighlighted rows

Hiding Rows when result of formual is 0 www.computing.net/answers/office/hiding-rows-when-result-of-formual-is-0/8965.html

How to hide entire row in Excel if value 0? www.computing.net/answers/office/how-to-hide-entire-row-in-excel-if-value-0-/9330.html

Excel adjust row heights www.computing.net/answers/office/excel-adjust-row-heights/9694.html