+ Reply to Thread
Results 1 to 2 of 2

Select Case VBA with multiple criteria

Hybrid View

Sky188 Select Case VBA with multiple... 02-28-2013, 03:36 PM
Sky188 Re: Select Case VBA with... 03-01-2013, 08:15 PM
  1. #1
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Select Case VBA with multiple criteria

    Good afternoon all,

    I'm looking for a way to use the Select Case VBA to run with multiple sets of Criteria; Ill elaborate below.
    I'm currently using the below code.
    Select Case Sheets("Questionairr").Range("O22").Value
        Case 1: Sheets("Products To Be").Range("8599:8602, 8999:9002").EntireRow.Hidden = False
        Case 2: Sheets("Products To Be").Range("8599:8606, 8999:9006").EntireRow.Hidden = False
        Case 3: Sheets("Products To Be").Range("8599:8610, 8999:9010").EntireRow.Hidden = False
        Case 4: Sheets("Products To Be").Range("8599:8614, 8999:9014").EntireRow.Hidden = False
        Case 5: Sheets("Products To Be").Range("8599:8618, 8999:9018").EntireRow.Hidden = False
        Case 6: Sheets("Products To Be").Range("8599:8622, 8999:9022").EntireRow.Hidden = False
    End Select
    What I'm ultimately looking to do is add another case that does the same as the above, but make it much more specific; so if O22 = 1 & O23 = 1, hide X rows.

    To elaborate a slight bit more from another angle, I've just gone through and added a function in column A for each of my rows that utilises IF, And, and OR statements, that looks at my two data validation cells and either returns a 0 or a 1 in column A, and if Data Validation cell 1 has a value, it returns a 1 for everything, and if both Data validation A and B have values, it only returns a 1 to those rows that meet the data validation requirement of Data Validation B, and then it hides everything with a 0.
    Attached Files Attached Files
    Last edited by Sky188; 03-01-2013 at 08:17 PM.

  2. #2
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Select Case VBA with multiple criteria

    I've attached an example of what I have going now, and what I'd like to happen.

    Short summary: B2 = color of a rope, D2 = length of rope based off what is selected in B2. I can get it so the length is limited the first time it is selected based on a function in column A, but after a second length is selected it hides everything (or rather, hides everything that isnt selected, which is already hidden, thus it doesnt unhide). You're able to choose one length and multiple colors and it works fine, just not one color with multiple lengths.
    Last edited by Sky188; 03-01-2013 at 08:18 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