+ Reply to Thread
Results 1 to 3 of 3

SELECT CASE with INSTR is it possible???

  1. #1
    Registered User
    Join Date
    07-25-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    29

    SELECT CASE with INSTR is it possible???

    I have code that checks for a string of data with in another string. I am new to Excel VB programming so I don't know if this is supposed to work or not. The string being checked does have the value of the search argument, however the Case does not happen. It is always going to the Case Else
    Here is the code:

    Please Login or Register  to view this content.
    Thanks for your replies!

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: SELECT CASE with INSTR is it possible???

    Unless I'm misreading your code, I believe that you have a mistaken understanding of the SELECT CASE function.

    SELECT CASE XXX treats XXX as the argument, and the CASE is treated as the validation. In this example, SELECT CASE strPathFile seems to be a text entry. In that syntax, each CASE argument checks if the result of your formula is strPathFile. However, (again, unless I'm misreading the code), each of the CASE formula arguments returns a TRUE/FALSE.

    Try chaning the first line of the SELECT CASE to

    Please Login or Register  to view this content.
    instead of
    Please Login or Register  to view this content.
    See if that works. If not, post a sample workbook with dummy data (in xls format please)

  3. #3
    Registered User
    Join Date
    07-25-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: SELECT CASE with INSTR is it possible???

    The suggestion you made work fine. I changed the value in the main select to true and it worked fine. Thank you for your response!!

+ 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