+ Reply to Thread
Results 1 to 5 of 5

VLookup over multiple sheets

  1. #1
    Registered User
    Join Date
    07-24-2015
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    16

    VLookup over multiple sheets

    I'm trying to make an userform with a textbox. The value entered in the textbox is the search value for VLOOKUP.
    The VLOOKUP must search for the value in two sheets and give its result in a msgbox.

    I've been only able to get Err.Number = 1004 as reply.

    What am I doing wrong?


    Please Login or Register  to view this content.

  2. #2
    Forum Contributor Obsessed's Avatar
    Join Date
    05-22-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 365
    Posts
    215

    Re: VLookup over multiple sheets

    You need error handling. Since you're looking at two sheets you either need to tell it to ignore errors (since it will always error on one of the two sheets), or you need to first check to see which sheet the data is on first. You could do countifs on each range and if countif = 1 you know it's on that sheet, and have the lookup occur on only that sheet.
    Want to show appreciation for the help you received from a member? Give them reps by clicking the bottom left of their post!

  3. #3
    Registered User
    Join Date
    07-24-2015
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    16

    Re: VLookup over multiple sheets

    That sounds obvious. Unfortunately I don't know enough VBA to sort it out.
    I do understand that I have to stop the VLOOKUP if the result has been found in the first sheet, but I have no clue how to use the Countif functions.

  4. #4
    Registered User
    Join Date
    07-24-2015
    Location
    Netherlands
    MS-Off Ver
    2010
    Posts
    16

    Re: VLookup over multiple sheets

    Any help to get this VBA working is welcome
    Can't find a question/solution on VLOOKUP in multiple sheets using VBA on this or any other forum.

    The code below works only for sheet1.
    but entry in sheet 2 cannot be found. And if the entry is in sheet1, and I enter a wrong batch code I don't get the msgbox "Not present"


    Please Login or Register  to view this content.
    Last edited by artsjeroen; 11-12-2015 at 06:29 AM.

  5. #5
    Forum Contributor Obsessed's Avatar
    Join Date
    05-22-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 365
    Posts
    215

    Re: VLookup over multiple sheets

    Upload a workbook, so people can take a look at it.

+ 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. Macro using VLOOKUP with multiple matches between multiple sheets
    By tripathy69 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2014, 10:14 AM
  2. Excel Vlookup, multiple sheets and multiple variables
    By caninekopz in forum Excel General
    Replies: 3
    Last Post: 11-27-2013, 10:33 AM
  3. Vlookup (or index/match) with multiple criteria over multiple sheets
    By Groovicles in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-18-2013, 01:56 PM
  4. Vlookup function to return multiple values from multiple sheets
    By bsamant in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-13-2013, 11:31 AM
  5. Macro using VLOOKUP with multiple matches between multiple sheets
    By Derrek0204 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2011, 06:20 PM
  6. Replies: 8
    Last Post: 03-30-2011, 11:09 AM

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