Macro stopped working, but works when I step through it

looknsee

New Member
Joined
Apr 23, 2015
Messages
9
I've recently added several new macros, and they are functioning well, but some of my old macros are not working. When I execute the old macros, I get a pop-up window with "Windows Visual Basic for Application" as it's title, and ":oops: 400" as the message; there also are an "OK" and a "Help" button. The "Help" button just fires off a generic top level Microsoft Help window. This MsgBox does not come from my macro.

So, from the Developer ribbon, I choose "Macros" and choose the impacted macro. When I step through the macro, it executes as expected.

Note: Several of my "old" macros behave this same way.

Any clues? Thanks.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
If the Error 400 is not telling where the error is, and not highlighting the offending line for you...
You can try to trap the error yourself.
(There are way more elaborate ways of doing this! But this should start you off)

Code:
Sub x ()

   'Place this at the head of your code
   On Error GoTo WhyAnnoyingError
 
  'Place this that end end your code
WhyAnnoyingError:
   MsgBox Err.Description
End Sub

My bet is that the "old" macros are trying to select worksheets or named ranges that no longer exist (-;
 
Last edited:
Upvote 0
Okay -- I don't understand this, but I've found a work around that made this problem go away.

I was using a customize ribbon containing all the macros associated with this big honkin' spreadsheet. I had added a few new macros, but I didn't touch the old ones. It surprised me that the old macros stopped working.

My workaround: I re-created the custom ribbon, removing the old macros and adding them back in. Then, no problem. Go figure.
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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