Results 1 to 7 of 7

Conditional Hide/Unhide if Cells Change

Threaded View

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    Virginia
    MS-Off Ver
    2010
    Posts
    10

    Conditional Hide/Unhide if Cells Change

    I am trying to hide/unhide rows when cell ("C9") changes. Cell "C9" changes based on selections from drop boxes in cells "C5", "C7" and "C8". It's been a while since I've used VBA in Excel so I was browsing online and came up with the following:

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Sub HideOverlay()
        Application.ScreenUpdating = False
        Application.EnableEvents = False
        
        Range("'Quantities-Alt1'!A1:A" & Rows.Count).EntireRow.Hidden = False
        
        If Range("'Quantities-Alt1'!C9").Value = "Asphalt Overlay" Then
            Range("'Quantities-Alt1'!A16:A22").EntireRow.Hidden = True
        Else
            Range("'Quantities-Alt1'!A11:A15").EntireRow.Hidden = True
        End If
    
        Application.EnableEvents = True
        Application.ScreenUpdating = True
    End Sub
    This works the first time cell "C9" changes but when it changes again (based on the selection in cell "C5", "C7" and "C8"), it does not hide/unhide the cells. I think I have to use Select Case or a loop or something but I haven't done this in a long time.

    Any help is appreciated!

    Thanks,
    Nichole
    Last edited by 6StringJazzer; 09-22-2014 at 02:36 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] hide unhide columns with selected cells change font size
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-21-2014, 10:17 AM
  2. Hide and unhide rows will change the color fill of the specified cells
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2013, 10:03 PM
  3. Conditional Hide/Unhide Rows
    By Edward HS in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-17-2013, 05:17 PM
  4. conditional hide unhide columns in different sheet
    By ss_bb_24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2008, 07:20 AM
  5. Conditional Hide/Unhide Rows
    By Gwen H in forum Excel General
    Replies: 4
    Last Post: 03-30-2005, 02:06 AM

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