+ Reply to Thread
Results 1 to 4 of 4

Find String in an Excel list using VBA

  1. #1
    Registered User
    Join Date
    10-06-2006
    Posts
    82

    Find String in an Excel list using VBA

    Dear Excel Expert,

    I have a dynamic list in Excel that will contain strings representing codes.

    i.e

    MEM
    YYZO
    KAC
    PAPKG
    QEP
    LMNT


    The user can add or delete from the list but the list will remain contiguous.


    In my vba code I currently have the below line which has the codes hard coded.

    If Not (varElement.Broker = "MEM" Or varElement.Broker = "YYZO" Or varElement.Broker = "KAC" Or varElement.Broker = "PAPKG") Then

    How do I convert the hard coded NOT (A OR B OR C ...) to use the dynamic list instead?

    Thank you
    Last edited by ions; 01-22-2013 at 10:32 AM.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Find String in an Excel list using VBA

    Assumed your data Range is From A11 cell.

    Add this code insted of

    Please Login or Register  to view this content.

    Code to be added

    Please Login or Register  to view this content.
    Last edited by kvsrinivasamurthy; 01-22-2013 at 11:27 AM.

  3. #3
    Registered User
    Join Date
    10-06-2006
    Posts
    82

    Re: Find String in an Excel list using VBA

    Thank you very much for the code.

    I renamed the variables. Also my list starts at H where H1 is the List Label.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Find String in an Excel list using VBA

    Pl mark the thread SOLVED.

+ 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