jassybun
Member
In this sub, is it possible to make a message box to user to let them know what was "Not found" so they can add any missing items and run again?
Sub Lookup()
Dim Rng As Range
Dim c As Range
Dim result As String
Set Rng = Range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row)
For Each c In Rng.Cells
On Error Resume Next
result = Application.WorksheetFunction.VLookup(c.Value, Workbooks("Lookup.xlsm").Worksheets("Sheet1").Range("A2:B350"), 2, False)
If Err.Number <> 0 Then result = "Not Found"
On Error GoTo 0
c.Offset(, 3).Value = result
result = vbNullString
Next c
End Sub
Sub Lookup()
Dim Rng As Range
Dim c As Range
Dim result As String
Set Rng = Range("c2:c" & Cells(Rows.Count, 2).End(xlUp).Row)
For Each c In Rng.Cells
On Error Resume Next
result = Application.WorksheetFunction.VLookup(c.Value, Workbooks("Lookup.xlsm").Worksheets("Sheet1").Range("A2:B350"), 2, False)
If Err.Number <> 0 Then result = "Not Found"
On Error GoTo 0
c.Offset(, 3).Value = result
result = vbNullString
Next c
End Sub