Keep Source Format with VLOOKUP CODE

  • Hi

    Please bear with me while I'm new to VBA / Macros...

    I am using VLOOKUP to lookup value ("Worksheet Criteria") from another worksheet ("Criteria Lookup"). I would like to match the source formatting (or at least the cell color).

    I have tried several codes I found in forums, but I can't get it to work. I either get #value! or #name? errors.

    Can anyone help?

    Thanks in advance!!

  • this is what I tried (but didn't work) - I assume I did the renaming (red below) wrong...

    Replace Worksheets("destination")with the sheet name that you inserted the

    LookupKeepColor Function into. Replace Worksheets("source") with values you are looking up.

    Replace vlookup in the sheet with the syntax like LookupKeepColor(E2,$A$1:$C$8,3)

    Add Reference 'Microsoft Script Runtime' by Tools > References.

    Edited once, last by royUK: Add Code Tags ().

Participate now!

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