Hi all,
I am trying to create a macro that will cross reference two lists and return the matches across the list. The problem is that the Vlookup function isn't properly working even though I know the variables in it are properly set (I copied and pasted them with VBA to make sure this wasn't the problem). Other advice online says to use On Error Resume Next in case the Vlookup isn't returning a match, but I know that the value its searching is in the table so this fix isn't working for me. Here is my code:
Thanks for looking!
I am trying to create a macro that will cross reference two lists and return the matches across the list. The problem is that the Vlookup function isn't properly working even though I know the variables in it are properly set (I copied and pasted them with VBA to make sure this wasn't the problem). Other advice online says to use On Error Resume Next in case the Vlookup isn't returning a match, but I know that the value its searching is in the table so this fix isn't working for me. Here is my code:
Code:
Sub xpt4()
Dim FindUI As String
Dim etRange As Range
FindUI = ActiveSheet.Previous.Cells(7, "AJ")
Set etRange = Workbooks("Estimation_Tools_May.xml").Worksheets("ms_tools").Range("$I$1:$W$163")
i = 2
Do While ActiveSheet.Previous.Range("A" & i) <> ""
Cells(i, 1) = WorksheetFunction.VLookup(FindUI, etRange, 1, False)
i = i + 1
Loop
End Sub
Thanks for looking!