Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Error trapping


Hi Group,

I am having a hard time trapping an error and doing what I want to do next.

I am looking up values on a worksheet and it is possible that the value will
be "#N/A". I am comparing two values and the "#N/A" could be one of those
values, so beta(b) = ERROR 2042.

I would like to check if beta(b) does equal ERROR 2042 and then go to the
bottom of my loop.

Thanks for your help.
David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Error trapping

You might want to post the code you're currently using. If I
understand your problem correctly, you want to trap Err.Number 2042.
There are (at least) two ways to do it. The simplest way is to use On
Error Resume Next before the "problem statement" (the one likely to
cause the error) then check if the error occurred.

Ex:

On Error Resume Next
x = x / 0
If Err.Number = 2042 Then
' take action if error occurs
End If
On Error GoTo 0


HTH,
JP

On Jul 1, 2:16*pm, David wrote:
Hi Group,

I am having a hard time trapping an error and doing what I want to do next.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Error trapping

Figured it out thanks.
David

"David" wrote:

Hi Group,

I am having a hard time trapping an error and doing what I want to do next.

I am looking up values on a worksheet and it is possible that the value will
be "#N/A". I am comparing two values and the "#N/A" could be one of those
values, so beta(b) = ERROR 2042.

I would like to check if beta(b) does equal ERROR 2042 and then go to the
bottom of my loop.

Thanks for your help.
David

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Error trapping

It would be nice if you would share your solution with the group.

--JP

On Jul 1, 3:17*pm, David wrote:
Figured it out thanks.
David

"David" wrote:
Hi Group,


I am having a hard time trapping an error and doing what I want to do next.


I am looking up values on a worksheet and it is possible that the value will
be "#N/A". I am comparing two values and the "#N/A" could be one of those
values, so beta(b) = ERROR 2042.


I would like to check if beta(b) does equal ERROR 2042 and then go to the
bottom of my loop.


Thanks for your help.
David

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Error trapping


Hi JP,

If IsError(alpha(a)) Then
AlphaErrorCt = AlphaErrorCt + 1
GoTo erroralpha
End If

Hope that helps.

Thanks,
David

"JP" wrote:

It would be nice if you would share your solution with the group.

--JP

On Jul 1, 3:17 pm, David wrote:
Figured it out thanks.
David

"David" wrote:
Hi Group,


I am having a hard time trapping an error and doing what I want to do next.


I am looking up values on a worksheet and it is possible that the value will
be "#N/A". I am comparing two values and the "#N/A" could be one of those
values, so beta(b) = ERROR 2042.


I would like to check if beta(b) does equal ERROR 2042 and then go to the
bottom of my loop.


Thanks for your help.
David


Reply
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 Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
Trapping #VALUE! error RhysPieces Excel Discussion (Misc queries) 6 August 22nd 07 03:13 AM
while deleting rows it finds an error - error trapping Janis Excel Programming 2 July 19th 07 12:12 AM
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
error trapping [email protected] Excel Programming 2 April 5th 05 12:52 AM


All times are GMT +1. The time now is 12:20 AM.

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"