Hi @Santek Brenner
Thank you for reaching out via the Microsoft Q&A forum.
Based on the information you shared, I understand that you are automating a workflow in Excel for Mac using VBA, but you are encountering an issue where standard Workbook events (like Workbook_Open and Worksheet_Change) do not trigger consistently. While the code works perfectly on Windows, the events on macOS only fire intermittently, particularly after reopening the file or switching sheets.
To help me analyze this better, could you please provide the specific VBA code snippets you are using via Private Message?
In the meantime, please try checking the following troubleshooting steps:
- Ensure Macros are Enabled
First and foremost, ensure that macros are enabled on your Mac. Sometimes, Excel can disable macros for security reasons, preventing your events from firing.
- Go to Excel > Preferences > Security & Privacy > Ensure that permissions are set to allow macros
- Use Application.OnTime for Delayed Execution
In some cases on Mac, events try to fire before the workbook is fully loaded. Adding a slight delay to your event code may help ensure that the event triggers correctly. You can use Application.OnTime to schedule a procedure to run after a slight delay.
- Check Application.EnableEvents
Occasionally, Excel might disable events after certain actions (especially after errors). You can use Application.EnableEvents = True inside your Workbook_Open or Workbook_Activate event to make sure they are active.
Is EnableEvents being intentionally disabled elsewhere in your code? If you wrote the code, check if you set Application.EnableEvents = False at some point (to prevent infinite loops) but forgot to set it back to True, perhaps due to code exiting before reaching the end of a subroutine.
- Test in a New Workbook
If possible, test your code in a completely new workbook on your Mac. There might be something specific to the current workbook (corruption, specific settings, or add-ins) that is interfering with event handling. If the new workbook works fine, you may want to look into repairing the original file.
Please let me know the results!
If the answer is helpful, click "Accept Answer" and kindly upvote. If you have additional questions about this answer, click "Comment".
Note: Follow the steps in our documentation to enable email notifications if you want to receive notification related to this topic.