+ Reply to Thread
Results 1 to 3 of 3

Need help using CASE statement to eliminate many ANDs

  1. #1
    Registered User
    Join Date
    07-06-2011
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    7

    Need help using CASE statement to eliminate many ANDs

    I am sure this isn't the best way to write this code, but I am not totally familiar with how to use a CASE statement to replace all these ANDs or if there is even a better option. The part of the code that has this is just a regular IF/THEN, with a fair amount of exclusions. It is listed here.


    Please Login or Register  to view this content.


    I assume this will work for now, I am just trying to figure out a better way to write it in case there are more exclusions.



    If you need the whole sub to see the variables, I have copied it below.



    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need help using CASE statement to eliminate many ANDs

    hi broncosrul, this

    Please Login or Register  to view this content.
    could be changed to this:

    Please Login or Register  to view this content.
    and add Dim line for shnames variable:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-06-2011
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Need help using CASE statement to eliminate many ANDs

    Very, Very cool. I was not familiar at all with InStr. I had to do a little Googling to see how it worked to understand your solution. But that is a very clever way to deliver a "not in list". Thanks so much for your help.

+ 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