Link to home
Start Free TrialLog in
Avatar of Mamarazzi
MamarazziFlag for Sweden

asked on

Copying data using key column and excluding #N/A

I want to copy data from one workbook to another using a key column that exist in both.

So far I've tried using VLOOKUP but I'm not sure it is the best way.

I have a button that runs a macro. First I select the cells I want the formula in:

Sub Copy_Formula()
    Selection.ClearContents
    Selection.FormulaR1C1 = _
        "=VLOOKUP(RC[-7],[Book2.xls]Sheet1!R5C3:R181C4,2,FALSE)"
End Sub

This works fine, BUT... I want the values in the cells, not the formula itself. And I want to clear the #N/A that I get in the cells if the formula has no match.

Any idea?
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mamarazzi

ASKER

Fabolous! Thanks