error handling in a collection

Ken Cowen

Board Regular
Joined
Jan 18, 2015
Messages
217
I am looping through a collection and try to trap the error that occurs when the member of the collection does not exist. I can't get my error handling to deal with the situation, it just ignores my direction to go to a line number and crashes.

On Error GoTo 32

If Not IsError(Lwks(str).ProgD) Then

If str does not exist in the collection Lwks, then I expect and error (5) and would like to go to line 32. If it does exist, it works fine but rather than go to line 32 when it errors, it just crashes.

What am I missing?

Thanks

Ken
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You need to use On Error GoTo lineLblName or On Error Resume Next statements.

ISERROR function is used to check for error values like #N/A, #VALUE !, #REF !, #DIV/0!, #NUM !, #NAME? or #NULL - usually caused by formulas.
 
Last edited:
Upvote 0
There seems to be something more problematic than usual about this particular error. It ignores my got line number, it just crashes. I have had trouble with trapping this particular error before and I can't remember how I got it to work. There was some sort of trick to it.
thanks
Ken
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top