Results 1 to 6 of 6

Userform vlookup - error when name not in spreadsheet

Threaded View

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    Wales
    MS-Off Ver
    Excel 2003
    Posts
    13

    Userform vlookup - error when name not in spreadsheet

    Hi all,

    Wondered if anyone can help, I've been going through the forums to see if I can find help but nothings coming up.

    I have a userform where I choose an employees name from a combobox, then use a vlookup to pull corresponding data from a spreadsheet such as department, etc.. That works works great thankfully, but if I type in an employees names into the combobox that's not in the spreadsheet I get the attached message.

    Here is the code I use for the vlookup:-

    var1 = Application.VLookup(EmployeeName.Value, Worksheets("Manning List").Range("Manning_list"), 4, False)


    SAPNumber.Value = var1

    var2 = Application.VLookup(EmployeeName.Value, Worksheets("Manning List").Range("Manning_list"), 3, False)

    Staff_Agency.Value = var2

    I've tried to use a if else in the code to do nothing in the eventuality that the code doesn't find the name as it shouldn't exist but I'm getting nowhere.

    Lack of knowledge unfortunately, so if anyone can help I'd be V grateful.

    Thanks
    Glynn

    Attached Images Attached Images

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