+ Reply to Thread
Results 1 to 3 of 3

Compare user input with range (with an if statement)

  1. #1
    Forum Contributor
    Join Date
    05-01-2006
    Location
    Erie, Pa USA
    MS-Off Ver
    Vista - Excel 2003
    Posts
    132

    Compare user input with range (with an if statement)

    I'm trying to do the following:

    The user enters a name in an input box
    The name is compared to a range (in this case, the range is called "Names")
    If the name is contained within the range, copy it to A1
    If the name is not contained in the range, close 2 files("status change" and "vacation") and show a msgbox UserEntry & " not found!!"

    Please take a look at my code and let me know what I'm doing wrong:
    Please Login or Register  to view this content.
    I don't know how to combine the code to get it to copy if it is there and do the other commands if it is not.

    Thanks in advance for any help you can provide.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Is this what you mean?

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    05-01-2006
    Location
    Erie, Pa USA
    MS-Off Ver
    Vista - Excel 2003
    Posts
    132

    sort of...

    with an incorrect name (one that is not found in the range) - it jumps to the else statement, but does not close the two files.

    with a correct name it also jumps to the else statement.

    If it is not in the range, It should close the files, display the msgbox & exit

    If it is in the range it should copy the user input to cell A1 and continue

    Thank you for the 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