Multiple jump VBA# # on the error go to # # consult
The code is as follows:
The Function Owner (CPN as string, WholePN as range, Versionless as range) as string
Err. Clear
On Error GoTo, Line1
Owner=WorksheetFunction. Vlookup (CPN, WholePN, 3, 0)
GoTo FinalOwner
, Line1:
Err. Clear
On Error GoTo Line2
Owner=WorksheetFunction. Vlookup (Left (CPN, Len,) - 3), Versionless as range, 2, 0)
GoTo FinalOwner
Line2:
Err. Clear
On Error GoTo Line3
The Owner=WorksheetFunction. Vlookup (Left (CPN, Len,) - 1), WholePN, 3, 0)
GoTo FinalOwner
Line3:
Err. Clear
On Error GoTo Line4
The Owner="NA"
FinalOwner:
End the Function
Tests found the line 5 and line 11 can come out, but what you two are "# VALUE!"
Regardless of the CPN on principle is what, as a result, the worst is "NA" to ah, why come out "# VALUE!" ? Great god give advice or comments, thank you!