+ Reply to Thread
Results 1 to 3 of 3

Checking string against all string elemenys in an array

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    25

    Red face Checking string against all string elemenys in an array

    Hello,

    I have few simple questions. So basically I have a variable that takes user input and I have my array that contains all necessary string values.
    I need to run a do until loop that would break only when user input equals any of the array elements (it can only be equal to one of them).

    So the questions that arise:
    1) how do I run do until loop that would check whether user input equals any of the elements in my array (not just one of them)
    2) also that check would have to look at the first three letters of each array element

    Thank you guys
    Last edited by Nazariy; 06-11-2014 at 08:22 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Checking string against all string elemenys in an array

    1) dont use an array use a collection, you have a key and value then, you'll pass them both the same, then trying to put a value in with the same key will cause an error, traping this error will enable you to tell whether its in there or not.
    2) RIGHT, MID
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    03-07-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Checking string against all string elemenys in an array

    1)What if the key and value passed is not in there, will that add the unnecessary pair?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. simple question.. i think
    By argoguy in forum Excel General
    Replies: 2
    Last Post: 03-23-2007, 07:28 PM
  2. A simple question requiring a simple answer
    By Pedros in forum Excel General
    Replies: 3
    Last Post: 07-18-2006, 06:45 AM
  3. Simple Simple Excel usage question
    By BookerW in forum Excel General
    Replies: 1
    Last Post: 06-23-2005, 05:05 PM

Tags for this Thread

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