Hi,
I am new to VBA and would like to use a full path for the Application.WorksheetFunction.VLookup method but cannot make it to work. I really googled for answers but cannot find a perfect example so I really need some help. So in summary I just need help with the arg2 part since I was able to make it work with the commented out code Worksheets("Sheet2").Range("A:B").
Here's my code:
Thanks in advance.
I am new to VBA and would like to use a full path for the Application.WorksheetFunction.VLookup method but cannot make it to work. I really googled for answers but cannot find a perfect example so I really need some help. So in summary I just need help with the arg2 part since I was able to make it work with the commented out code Worksheets("Sheet2").Range("A:B").
Here's my code:
Code:
For Each cell In namedRangeCompanySize
On Error Resume Next
' lookUpResult = Application.WorksheetFunction.VLookup(cell, _
' Worksheets("Sheet2").Range("A:B"), 2, 0)
lookUpResult = Application.WorksheetFunction.VLookup(cell, Workbooks.Open("C:\Users\sngutierrez\Desktop\MAINICHI FILES\01-ALL-IN-ONE-2018IM.xlsm").Sheets("CO_SI").Range("A:B"), 2, 0)
On Error GoTo 0
If lookUpResult = "" Then
cell.Interior.Color = 65535
Else
cell.Value = lookUpResult
lookUpResult = ""
End If
Next
Last edited by a moderator: