Results 1 to 2 of 2

Select Case VBA with multiple criteria

Threaded View

  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.

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