Results 1 to 4 of 4

If cell value does not match a value from a list?

Threaded View

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    Santa Ana, CA USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    If cell value does not match a value from a list?

    Greetings, all!

    I am trying to find a way to prevent employees from incorrectly typing in their employee number. I can do it caveman-style by using:

    If Cells(19, 4).Value <> 1000 Then
        MsgBox prompt:="That employee # does not exist"
        Exit Sub
    End If
    I would have to make a new "If" segment for every employee, though. If I could use "Or" (<> 1000 Or 1204 Or 5492, etc.) it would seem pretty straightforward. And since the employee numbers aren't in tight sequence I can't just use > 1000 and 5000 < as it would still allow for typing in an nonexistent employee number within that range.

    Is there an easy way to add an array of acceptable numbers within a single If command?
    Last edited by smaier69; 06-06-2013 at 12:22 PM. Reason: Removed variable in copy/pasted code's Cells.

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