Vlookup in excel vba

  • trying to set a vlookup function in excel vba instead of worksheet formula.


    what i wanted is whenever i put id no. in my sample format(sheet1 Range "C3"), details will show automatically as vlookup formula
    in worksheet, data base lookup is in (sheet2).


    kindly see sample attached file.


    Thanks guys in advance and more power!



    :thanx:

  • Re: Vlookup in excel vba


    Thanks for the advise Sir Roy, but i will be more than happy if I got or I'v learn my subject concern.


    any one can give a help?


    Thanks in advance guys... more power...!

  • Re: Vlookup in excel vba


    See attached workbook, adopt as per your requirement if this how you wanted.


  • Re: Vlookup in excel vba


    That is a real waste of time. All that way ove rcomplicated VBA to do what can be dine more efficiently with a formula is ridiculous!

  • Re: Vlookup in excel vba


    I should point out that the posted code fails on my machine. Its no fault of the coding, just that Excel for Mac doesn't support dictionary objects.
    Thats one of the many reasons that native Excel formulas are preferred over VBA.
    Another is that changing lay-outs, moving cells, inserting rows etc can be accomplished without the added step of changing hard coded values in VB routines.

  • Re: Vlookup in excel vba


    Another reason is that if the end user does not enable macros then nothing happens.


    In short, native excel functions are generally faster because they are most certainly written in C/C++ which produces fast native code.


    This code works (not sure about with a Mac) but VLOOKUP would be faster


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!