Error Trapping Gives me Errors.....

acollier21

New Member
Joined
Oct 13, 2010
Messages
7
Hi All,

I have some error trapping that I've been using that has worked great in the past, but for some reason, it suddenly stopped working. I had to add in some code and I always make sure to use On Error Goto 0 to disable the trap I just set.

Towards the end of my macro, there's a line of code I'm using to make a directory. I use On Error Resume Next and then I type my Mkdir line and close it off with on error goto 0. However, the error still comes up even though I did error trapping. I used the exact same code in a macro just by itself and it worked fine.

Is there something I'm missing or some error trap I didn't close properly that would cause this to happen? Any help is appreciated. Thanks so much!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

acollier21

New Member
Joined
Oct 13, 2010
Messages
7
Maybe something else that will help is that some of my error trapping occurs within a loop. Some of my error trapping also is On Error Goto <something>: . It doesn't necessary go to an exit sub or anything like that. Some of the error trapping I have involved cells.find. (If it finds the value, then it does some stuff with it and then moved on. If it doesn't find the value, then I have On Error Goto <something>: to make it so that it skips all the stuff it would do if it found a certain text string).

Does this all make sense? I'm totally confused why it would work for so long, and then plain not work anymore. Another interesting issue is that if I skip over the error that I tried to trap, it finished the loop, starts at the top again and then a part that I had error trapping on (that worked before) now doesn't work.

*sigh*
 

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,836
Office Version
  1. 2019
Platform
  1. Windows
You may want to try to recompile the program - make some arbitrary changes like adding a comment or deleting and re-entering a line, and hit compile again. It could be worth even importing to a new module - just try to get a clean start, here.
 

Forum statistics

Threads
1,136,779
Messages
5,677,684
Members
419,712
Latest member
LearningCR

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
Top