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: 39
Default Error capture mechanism, then 'End' or 'Exit Sub'?

Hi all,

Im in a situation to capture an error with details as follows:
The user may import some data and then the macro will look up some
values according to the import (VLOOKUP function). If the import data
is not found, the default error value '#N/A' will be returned. In this
scenario, the user will get a warning message. But how can this error
be captured?
I tried
If xxx.value = "#N/A" Then //<Runtime error '13' - Type
Mismatch fired here
<aler msgbox
(I also checked the value of xxx in the immediate window using '?xxx',
which gives 'Error 2042')

Then I tried
If IsNA(xxx.value) Then //<Compile error: Sub or Function
not defined fired here
(Also noticed that VBA automatically modified 'ISNA'(my original
typing) to 'IsNA'. Why is this???)

Im also quite confused by 'End' and 'Exit Sub', i.e. what difference
between the following:

If Error Then
<error Handling
End
End If

If Error Then
<error Handling
Exit Sub
End if

Thanks in advance and regards
Frank

 
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
Error Capture Problem leerem Excel Discussion (Misc queries) 2 August 7th 09 02:54 PM
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
Capture Update Links Error? Steph[_6_] Excel Programming 0 January 31st 06 03:26 PM
on error exit sub short_n_curly[_22_] Excel Programming 1 July 20th 05 07:01 PM
Capture event when exit Column G zSplash Excel Discussion (Misc queries) 2 December 27th 04 05:28 PM


All times are GMT +1. The time now is 07:18 PM.

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

About Us

"It's about Microsoft Excel"