A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello. One very important detail here is that your screenshot shows the workbook is saved as:
RAPORT KLS VI SEM 2.xlsx
A normal .xlsx file cannot properly store VBA macros. If the workbook originally contained macros and was later saved as .xlsx, Excel removes the VBA project but the buttons/shapes may still remain and continue trying to call the old macro, which produces this exact error.
Please check this too:
- Save the workbook as a macro-enabled workbook:
File → Save As → Excel Macro-Enabled Workbook (*.xlsm)
Then close and reopen the file.
- Press:
ALT + F11
to open the VBA Editor.
Check whether the procedure:
Sub Shape31_Click()
still actually exists. Also check inside:
- Modules
- Sheet objects
- ThisWorkbook
because button event procedures are sometimes stored in sheet modules rather than standard modules.
- In the VBA Editor, try:
Debug → Compile VBAProject
If there is a syntax error or broken reference anywhere in the project, Excel may prevent ALL macros from running even if the clicked macro itself is correct.
- Also check:
Tools → References
inside the VBA Editor.
If anything is marked:
MISSING:
the VBA project may fail to load correctly.
- If the file came from another PC, WhatsApp, Telegram, Google Drive, or email, Windows may still be sandboxing it even with macros enabled globally.
Try:
- Right-click the file
- Properties
- Check “Unblock” if present
or move the file into a Trusted Location in Excel.
- Another common cause is that the shape/button itself became corrupted or is still pointing to an old workbook reference after copying sheets between files. In that case:
- delete the button
- create a new one
- reassign the macro manually