Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A problem with #DIV/0! and circular reference errors | Excel Discussion (Misc queries) | |||
Statistical Functions ignoring errors | Excel Discussion (Misc queries) | |||
Errors on Functions with many arguments | Excel Worksheet Functions | |||
errors in worksheet functions | Excel Worksheet Functions | |||
Handling Errors from Worksheet Functions | Excel Programming |