LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Problem with worksheet functions and errors

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A problem with #DIV/0! and circular reference errors Wally3178 Excel Discussion (Misc queries) 3 January 17th 08 12:05 AM
Statistical Functions ignoring errors excelBRISKbaby Excel Discussion (Misc queries) 1 June 7th 07 08:35 PM
Errors on Functions with many arguments Ravi Excel Worksheet Functions 1 January 11th 07 03:27 PM
errors in worksheet functions bill gras Excel Worksheet Functions 4 September 24th 05 03:08 PM
Handling Errors from Worksheet Functions Nigel[_4_] Excel Programming 1 October 7th 03 07:46 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"