+ Reply to Thread
Results 1 to 2 of 2

Conditional Hide/Unhide

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

    Conditional Hide/Unhide

    I have a spreadsheet that has drop down lists that hides/unhides rows of cells based on the selection. The first set of lists are at the top and the second set are at the bottom. I noticed when I change other cells in the middle, it unhides the rows that were hidden based on the list selection at the top. Is there are reason it is doing this? I want to be able to change the selection at any point in the spreadsheets and be able to delete/add values in cells that have nothing to do with the change event below.

    Private Sub Worksheet_Change(ByVal Target As Range)

    Application.EnableEvents = False

    Range("A1:A" & Rows.Count).EntireRow.Hidden = False

    If Target = Range("C5") Or Target = Range("C7") Or Target = Range("C8") Then
    If Range("C9").Value = "Select ADT and ADTT (above)" Then
    Range("A11:A15").EntireRow.Hidden = False
    Range("A16:A22").EntireRow.Hidden = False
    ElseIf Range("C9").Value = "Asphalt Overlay" Then
    Range("A16:A22").EntireRow.Hidden = True
    Else
    Range("A11:A15").EntireRow.Hidden = True
    End If
    End If

    If Target = Range("C83") Or Target = Range("C89") Or Target = Range("C95") Then
    If Range("C83").Value = "No" Or Range("C83").Value = "(select)" Then
    Range("A84:A87").EntireRow.Hidden = True
    Else
    Range("A84:A87").EntireRow.Hidden = False
    End If
    If Range("C89").Value = "No" Or Range("C89").Value = "(select)" Then
    Range("A90:A93").EntireRow.Hidden = True
    Else
    Range("A90:A93").EntireRow.Hidden = False
    End If
    If Range("C95").Value = "No" Or Range("C95").Value = "(select)" Then
    Range("A96:A99").EntireRow.Hidden = True
    Else
    Range("A96:A99").EntireRow.Hidden = False
    End If
    End If

    If Target = Range("C107") Or Target = Range("C113") Or Target = Range("C119") Then
    If Range("C107").Value = "No" Or Range("C107").Value = "(select)" Then
    Range("A108:A111").EntireRow.Hidden = True
    Else
    Range("A108:A111").EntireRow.Hidden = False
    End If
    If Range("C113").Value = "No" Or Range("C113").Value = "(select)" Then
    Range("A114:A117").EntireRow.Hidden = True
    Else
    Range("A114:A117").EntireRow.Hidden = False
    End If
    If Range("C119").Value = "No" Or Range("C119").Value = "(select)" Then
    Range("A120:A123").EntireRow.Hidden = True
    Else
    Range("A120:A123").EntireRow.Hidden = False
    End If
    End If

    Application.EnableEvents = True
    End Sub

    Thanks,
    Nichole

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

    Re: Conditional Hide/Unhide

    Any suggestions/references for creating a change event when specific cells are changed that doesn't undo changes that were already made. When I change any cell using the above code, it "resets" my previous selections/changes. Any good examples I can look at? Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Conditional Hide/Unhide if Cells Change
    By engineer85 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-22-2014, 04:07 PM
  2. Conditional Hide/Unhide Rows
    By Edward HS in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-17-2013, 05:17 PM
  3. 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
  4. Is there a conditional formula to hide and unhide columns?
    By Frederic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2005, 06:06 AM
  5. [SOLVED] 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