N
NDBC
I am putting some error handling in my code. I have it working after doing
some searching on here but for my own understanding can someone explain why
this code works when there is an error in the vlookup result
Dim Name As Variant
'Tag scanned into column 1
If Target.Column = 1 Then
Application.ScreenUpdating = False
Name = Application.VLookup(Target.Value, Sheets("ID
List").Range("A3:B65536"), 2, False)
If IsError(Name) Then
Sheets("Running Sheet").Cells(Target.Row, 2) = ""
Else
Sheets("Running Sheet").Cells(Target.Row, 2) = Name
End If
And this code doesn't
Dim Name As Variant
'Tag scanned into column 1
If Target.Column = 1 Then
Application.ScreenUpdating = False
Name = Worksheetfunction.VLookup(Target.Value, Sheets("ID
List").Range("A3:B65536"), 2, False)
If IsError(Name) Then
Sheets("Running Sheet").Cells(Target.Row, 2) = ""
Else
Sheets("Running Sheet").Cells(Target.Row, 2) = Name
End If
They both work fine if there is no error but the second with the
worksheetfunction doesn't handle errors.
Thanks
some searching on here but for my own understanding can someone explain why
this code works when there is an error in the vlookup result
Dim Name As Variant
'Tag scanned into column 1
If Target.Column = 1 Then
Application.ScreenUpdating = False
Name = Application.VLookup(Target.Value, Sheets("ID
List").Range("A3:B65536"), 2, False)
If IsError(Name) Then
Sheets("Running Sheet").Cells(Target.Row, 2) = ""
Else
Sheets("Running Sheet").Cells(Target.Row, 2) = Name
End If
And this code doesn't
Dim Name As Variant
'Tag scanned into column 1
If Target.Column = 1 Then
Application.ScreenUpdating = False
Name = Worksheetfunction.VLookup(Target.Value, Sheets("ID
List").Range("A3:B65536"), 2, False)
If IsError(Name) Then
Sheets("Running Sheet").Cells(Target.Row, 2) = ""
Else
Sheets("Running Sheet").Cells(Target.Row, 2) = Name
End If
They both work fine if there is no error but the second with the
worksheetfunction doesn't handle errors.
Thanks