400 Error on Button Press Before Sub-Procedure Runs

kelyndm

New Member
Joined
Feb 22, 2016
Messages
5
I have a button (Form Control not ActiveX Control) that when pressed, calls a sub procedure inside inside a worksheet module for the worksheet that the button is on.
For whatever reason after opening the workbook the first time I click on the button, it produces a 400 error:
400+error.jpg

Every time I click on the button after this first time, it runs the sub procedure as expected.

As a test I put a "Stop" command as the first line of the sub and it seems as though the 400 error happens before the sub procedure is even called.

I also tested putting the exact sub procedure in to a new module and assigning the button to that sub procedure. Doing this results in no error - So I can run the sub procedure by clicking on the button if it is outside of the worksheet module, but not inside..:confused:

I am so baffled as to why this would happen. I have disabled all add-ins to see if that is what the issue is, but that didn't change anything.

Any ideas for what the problem might be or how I can fix it? I can move all of my code outside of the worksheet modules, but that would be quite a pain, because this same thing is an issue for many programs that I have written, and I would hate to have to change all of them.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,963
Messages
6,122,484
Members
449,088
Latest member
Melvetica

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