Hello,

I would like to create a macro. I have two worksheets, both containing an ID. Would like to update the price from the second worksheet corresponding to the ID.

Any ideas? I am quite new to this so a bit of guidance will be appreciated.

You could startby running the macro recorder and doing the actions you need manually. Look at the macro Excel came up with and generalize the macro to your needs.

Okay, I have managed to create the macro

Sub PlaceVLookupTMS()
' place in a standard module
With Sheets("Sheet2")
    .Range("D2:D" & .Range("A" & .Rows.Count).End(xlUp).Row).FormulaR1C1 = _
        "=IFERROR(VLOOKUP(RC[-1],Sheet1!C[-2]:C[1],4,FALSE),"""")"
End With
End Sub

The only problem now is that when there is no match I would like to set the cells to blank. Any ideas?

I have blank cells but they contain the formula: =IFERROR(VLOOKUP(C7,Sheet1!B:E,4,FALSE),"") when I click on them

I'm not really sure, but I think you can manage without a macro.
And if you can, by all means do.
Look at this example.
See if it can help you. Success!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.