Macros the stop working FOR NO REASON

ClimoC

Well-known Member
Joined
Aug 21, 2009
Messages
584
Hey guys

Can anyone point me to an article or post regarding random breaks of code? I'm talking really random - as in they've worked fine for ages, don't require anything from a Reference or Object library that no longer exists, but one day, they just stop working?

I had a macro that for months was working fine every day. It was simply adding checkboxes to a 'myrange' type area set by lastrows.

It did this in a loop through 8 sheets - and one day, 1 particular sheet stopped working - and gave application-defined or object-defined errors. I know it to be just that sheet - because all the others worked fine, and it always crashed when it got to that sheet - which is identical I might add to all the others bar a title at the top (and not even in the same column as where the checkboxes were going)

How did I fix it? I deleted the worksheet, remade it, and suddenly it works Fine!!!!


AND NOW... today, a really simple line just stopped working - again giving the 'application defined or object defined error'.

The line was
Rich (BB code):
ActiveWorkbook.Names(Sheets("Tools").Range("G5").Value).RefersToRange.Copy
        Worksheets("CustomReport").Range("B3").PasteSpecial xlPasteValuesAndNumberFormats

This has worked fine for a long time. I double checked the named ranges, they're all fine. I tried typing them in the cell_ref box, and it took me straight to the range.

I found an exact copy of the workbook from 3 weeks ago, and the same code in that workbook works fine!!!

So why is it that sometimes excel will just 'break'?

Has anyone else ever had this same problem?

Sometimes I'd find that something wouldn't work, I'd go home, come back in the next day, and the code would work again!

This is excel2003 I might add.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

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