Parts of Excel turn white or gray when you run VBA code in Excel 2013
Office 365 ProPlus is being renamed to Microsoft 365 Apps for enterprise. For more information about this change, read this blog post.
When you run Microsoft Visual Basic for Applications (VBA) code in Microsoft Excel 2013, portions of Excel may appear white or gray, depending on your Office Theme. It stays blank until the code completes. This issue may occur if the VBA code performs one or more of the following actions in a macro that runs long enough for the user to see the results before the macro completes:
- Repeatedly select cells
- Insert sheets
- Update or opens task panes
- Add a workbook
This issue is caused by the changes that are made in Microsoft Office 2013 to optimize the new graphics engine.
Use ScreenUpdatingto disable the screen updates of Excel so you do not see the changes while they are disabled. This also may improve your macro performance.
Application.ScreenUpdating = False Workooks.Add Application.ScreenUpdating = True
If you need to see the screen changes, insert a DoEvents command after the line in the code that causes the screen to appear white. Using DoEvents sparingly will help maintain macro performance.
This is a known limitation in Excel 2013.
For all versions of Excel, a similar effect can occur in long running macros when Windows turns the application white and marks it not responding. This occurs because Excel is not responding to Windows while the macro is running. DoEvents will also assist in this scenario by allowing Excel to respond to Windows and allow the application screen to recover.