Hello, I am having difficulty adding an IF statement withou it causing problems. I need the statement because when the following code searches and finds nothing, it stops. I tried an on error goto, but that made this code not work at all
I want to add something like
and have the code wait for next target selection.
Thanks for your time - Jim A
Code:
Sub Lookup(Target As Range)
Application.ScreenUpdating = False
Dim pFind As Range
'target.value is selected on sheet(4) and searches sheet(1) returning multiple values on sheet(4)
Set pFind = Sheets(1).Range("A:Z").find(What:=Target.Value, LookIn:=xlValues, LookAt:=xlPart).Offset(, -4).Resize(1, 11)
Target.Offset(, -4).Resize(1, 11).Value = pFind.Value
Application.ScreenUpdating = True
End Sub
Code:
If pFind = "" then MsgBox("Target value not found")
Thanks for your time - Jim A
Last edited: