Excel VBA Lookup Help
Hi I am having trouble with my VBA Lookup function. I have created 2 workbooks which I have instantiated to wbOld and wbNew. I am taking a column from wbOld and comparing with a range in wbNew. I want it to return the second column, with an exact match. Unfortunately, it is not working. I believe it to be a problem with my syntax. Can someone help. I am new to VBA.
Sub Comparison() Dim xOld As Integer xOld = 2 wbOld.Application.ActiveSheet.Cells(xOld, 21) = _ wbOld.Application.WorksheetFunction.VLookup(Cells(xOld, 19), _ wbNew.Application.ActiveSheet.Range("S:T"), 2, 0) End Sub
Eventually, I will get it to loop. If I can get it to work. Your help would be greatly appreciated. Thanks.