VBA Lookup using Scripting Dictionary

  • Hi All,


    I'm really trying to get my head around using a VBA scripting dictionary to do quicker vlookups.


    I'm using a simple test sheet with a small range to get my head around how this works.


    I am able to load values from a range "B1:B32" into the dictionary, and then retrieve them.


    I'm just stuck at how to compare this against another range, if the values match, then return the value. (ie perform like a regular vlookup)


    My code so far:


  • Re: VBA Lookup using Scripting Dictionary



    I tried this but it all game back as NAs, when it shouldn't be

  • Re: VBA Lookup using Scripting Dictionary


    Wait shouldn't it be rg2?


    Rg is the first range I load in the dictionary, and the second is the one we are searching against.


    Either way I'll try both

  • Re: VBA Lookup using Scripting Dictionary


    Try this....


    Regards.
    sktneer

  • Re: VBA Lookup using Scripting Dictionary


    Hi all,


    I found some code Jindon posted online and altered it and it worked.


    Thanks sktneer, your code worked as well!


    The code is as follows for those new to this, like me. I put commentary in it to make it less esoteric, for the uninitiated:


Participate now!

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