+ Reply to Thread
Results 1 to 4 of 4

Hide Cell(s) in list based on Color.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Hide Cell(s) in list based on Color.

    Hello,

    I have a list created with over 1200 rows.

    The list is a compilation of 3 seperate lists with duplicates.

    each list is represented by its own color, (yellow, orange, green)

    I want to create a check box for each color that will Hide the cells represented by that color.

    Can someone give me some pointers here?

    much appreciated.
    Last edited by garretonufer; 03-09-2010 at 01:26 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Hide Cell(s) in list based on Color.

    Try the attached and modify as required. It uses option buttons linked to a cell.

    Option Explicit
    
    Sub Hide_Rows_By_Color()
    
        Dim icolor As Long, c As Range
        
        Select Case Range("A1").Value
        
            Case 1: icolor = 6 'red
            Case 2: icolor = 45 'blue
            Case 3: icolor = 10 'green
            Case 4: 'show all
                Range("A5").CurrentRegion.EntireRow.Hidden = False
        End Select
        
        Application.ScreenUpdating = False
        
        On Error Resume Next
        For Each c In Range("A5").CurrentRegion
            If c.Interior.ColorIndex = icolor Then
                c.EntireRow.Hidden = True
            Else
                c.EntireRow.Hidden = False
            End If
        Next c
        
        Application.ScreenUpdating = True
    
    End Sub
    Last edited by Palmetto; 03-08-2010 at 09:33 PM. Reason: correct colorindex values
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Hide Cell(s) in list based on Color.

    I've tried to copy your macro and adjust accordingly, but haven't had any luck. I've attached the file, if you wouldn' tmind taking a look. Thank you.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-28-2009
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Hide Cell(s) in list based on Color.

    Nevermind, I'm using your file, and inserting my data. I don't fully understand the macro, but now have some idea. Thanks for the help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1