Fix Spaces Disappearing in the Excel for Mac VBA Editor
Question details
The user needs to stop the Excel for Mac VBA editor from removing spaces while code is being typed.

- Product
- Microsoft Excel for Mac VBA editor
- Device & OS
- macOS 10.14.4
- Scenario
- Editing VBA code in Excel for Mac version 16.22.
- Observed behavior
- Spaces disappear as they are typed, so the user must insert them after completing each line. The Tab key also has the same problem.
In Excel, open Excel > About Excel to confirm your version. Check the macOS version under Apple menu > About This Mac, and note whether the Tab key is also affected.
Update Excel and macOS to Compatible Versions
Use this approach first because the behavior may be a bug in the installed Excel for Mac build or its VBA editor.
In Excel, choose Help > Check for Updates and install the latest Office updates available for your Mac.
Open Apple menu > System Preferences > Software Update and install any compatible macOS updates offered.
Quit and reopen Excel, then open the VBA editor and type a line of code containing spaces to see whether they remain.

Compose VBA Code in a Plain-Text Editor
Use a plain-text editor as a temporary workaround if the VBA editor still removes spaces.
Report the VBA Editor Issue to Microsoft
Send a report if the problem continues after installing compatible updates.
Work on Spreadsheets with WPS Office
WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and Excel format compatibility for a smoother move between spreadsheet tools. It does not fix Microsoft's VBA editor, and VBA support may vary by version.

Frequently Asked Questions
Why does the Excel for Mac VBA editor remove spaces as I type?
The behavior may be a bug in the installed Excel build or its VBA editor. Use Excel > About Excel to check your version, then install compatible updates through Help > Check for Updates.
Can I use the Tab key instead of spaces?
Not necessarily. In the reported case, the Tab key was affected too. Try composing the code in a plain-text editor and pasting it into the VBA module instead.
How do I report the problem to Microsoft?
In Excel, look for Help > Feedback or Help > Send Feedback. Include your Excel and macOS versions and describe how to reproduce the disappearing spaces.
Will WPS Office fix the Excel VBA editor?
No. WPS Office is an alternative for spreadsheet work, but it does not repair Microsoft's VBA editor. VBA support can vary by WPS version.




