+ Reply to Thread
Results 1 to 10 of 10

VBA Vlookup help please

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    VBA Vlookup help please

    I have a very basic v lookup which i cant get working.

    The lookup searches for a range of values 1-4 then returns the corresponding value from column 3 of a seperate worksheet.

    The problem is that where i expect the lookup to return a blank value (i.e. it finds a match in the table but column 3 for the match is blank) it is instead returning the value of the previous lookup result.

    I have attached the file if someone could please help a desperate newbie.

    Many thanks in advance.

    Ash
    Attached Files Attached Files
    Last edited by ashmott; 07-26-2011 at 11:57 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Vlookup help please

    I ran your code, in your workbook and had no problems. Sheet 2 Range C3 was blank. I ran it multiple times and there seemed no mistakes.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Vlookup help please

    My apologies i have slightly changed the table values.

    The issue is where the lookup value in Sheet 2 is not found in sheet 1. If you run it now i think the code will returs a value of 4 when it searches for value 5. However 5 should not be found in column A of sheet 1 which is the lookup table.

    I really appreciate your help, this is driving me mad and i know it will be someone silly on my part.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Vlookup help please

    That is baffling.

  5. #5
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Vlookup help please

    Not only baffling but extremely annoying

    Can you think of another way to produce the same desired outcome?

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Vlookup help please

    I will post this for other who are far more talented at this than I so be patient and you'll have an answer soon I'm sure.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VBA Vlookup help please

    Shouldn't the vlookup in the code have a 4th argument, FALSE to find exact match?

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Registered User
    Join Date
    07-26-2011
    Location
    melbourne
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: VBA Vlookup help please

    NBVC that looks like the answer. You have just attained legend status in my humble opinion. Thankyou

  9. #9
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Vlookup help please

    @NBVC, I tried that after some research earlier and it didn't seem to make a difference to me. This is what I had done
    Please Login or Register  to view this content.
    I just ran it again and it still doesn't work.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VBA Vlookup help please

    It worked fine for me

+ 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