Macros on my spreadsheet that have been working for years, stopped working via buttons, though they still work fine from VBA Developer window. I use a normal shape (rectangle) as the button and assigned the Macro to it (selecting from "ThisWorkbook").
To head off suggested fixes I've seen for other similar posts...
- It is still an .xlsm file
- Macros are still enabled.
- It's running on the same laptop as before (Windows 10, Office 365).
- No Windows updates have occurred lately.
- I only have this one file open.
- I tried rebooting laptop and restarting Excel.
- I'm not using an Active-X Control.
- I tried it with a Form Control button and a regular Shape button - neither work.
- It's not related to the actual VBA code (see below for proof).
I created a new program to show the problem is not the code itself:
Sub button_not_working()
MsgBox "button_not_working"
End Sub
This program works using the green Play button in the VBA screen, but not via an assigned button on a sheet. Any idea would be greatly appreciated!
CodePudding user response:
Often this issue can occur due to multiple screens or resolution difference issues. If you are using a laptop connected to screens try using the button on the laptop while it's disconnected from your monitors. If this fixes the issue then ensure you have the same resolution and/or scaling between the two setups.
If this change only happened recently and is on a desktop or laptop screen without additional monitors ensure your scaling is set to 100% in case it has recently changed.
CodePudding user response:
Something to try: Make sure your 'caller' shapes have unique names
Note: It's possible to have multiple shapes with the same name and (for whatever reason) that can confuse excel's shape-to-macro-connection.