+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : Data Validation - Lists Multiple Criteria for Hidden Rows

  1. #1
    Registered User
    Join Date
    12-28-2011
    Location
    Here
    MS-Off Ver
    Excel 2007
    Posts
    43

    Data Validation - Lists Multiple Criteria for Hidden Rows

    I am working on creating a bunch of dropdown lists where the answers of some of the questions are dependent on others.
    So for example, if someone answers no from a yes/no question on line 34, rows 35:39 will be hidden and also rows 203:208 will be hidden.

    If Target.Address = "$G$34" Then
    Application.EnableEvents = False
    Select Case Target.Value
    Case "Yes"
    Rows("35:39").Hidden = False
    Rows("203:208").Hidden = False
    Case "No"
    Rows("35:39").Hidden = True
    Rows("203:208").Hidden = True
    End Select
    Application.EnableEvents = True
    End If

    However, I also have criteria set for rows 203:208.

    If Target.Address = "$G$203" Then
    Application.EnableEvents = False
    Select Case Target.Value
    Case "Permissive to Customer motor"
    Rows("204").Hidden = False
    Rows("205:208").Hidden = True
    Case "Permissive to Standard motor"
    Rows("204:208").Hidden = True
    Case "Permissive with Standard V.D."
    Rows("204").Hidden = True
    Rows("205").Hidden = False
    Rows("207").Hidden = False
    Case "Permissive with Customer V.D."
    Rows("204").Hidden = False
    Rows("205").Hidden = False
    Rows("207").Hidden = False

    On top of this, I have developed a command button that sets the entire spreadsheet to a basic standard of options.
    I am connecting this to the back end, so fields that are not standard will be filled in with a blank so as the items are not counted and not factored into the cost.
    The issue I am having is when I reset to the default, rows 203:208 are set to blank. Because I have multiple conditions from Rows 34 and also the conditions for the hidden rows for 203:208, it will not hide the rows of 203:208 when they are blank, even though row 34 states "No".

    How can I change the coding up so that even though 203:208 are blank, they still become hidden when row 34 is no.?

    -Bob

  2. #2
    Registered User
    Join Date
    12-28-2011
    Location
    Here
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Data Validation - Lists Multiple Criteria for Hidden Rows

    Figured out a solution, not sure it is the best. What I changed is in bold.

    If Target.Address = "$G$34" Then
    Application.EnableEvents = False
    Select Case Target.Value
    Case "Yes"
    Rows("35:39").Hidden = False
    Rows("203").Hidden = False
    Rows("205").Hidden = False
    Rows("207").Hidden = False

    Case "No"
    Rows("35:39").Hidden = True
    Rows("203:208").Hidden = True
    End Select
    Application.EnableEvents = True
    End If



    If Target.Address = "$G$203" Then
    Application.EnableEvents = False
    Select Case Target.Value
    Case "Permissive to Customer motor"
    Rows("204").Hidden = False
    Rows("205:208").Hidden = True
    Case "Permissive to Standard motor"
    Rows("204:208").Hidden = True
    Case "Permissive with Standard V.D."
    Rows("204").Hidden = True
    Rows("205").Hidden = False
    Rows("207").Hidden = False
    Case "Permissive with Customer V.D."
    Rows("204").Hidden = False
    Rows("205").Hidden = False
    Rows("207").Hidden = False
    Case ""
    Rows("203:208").Hidden = True

    End Select
    Application.EnableEvents = True
    End If

    It seems to work, but I'm sure I could write this a lot easier. Any suggestions would still be greatly appreciated!
    Last edited by BobBing; 03-07-2012 at 02:01 PM.

+ 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