VBA editor auto-deletes spaces at the ends of lines

I've definitely had that issue before, where the vba editor would format as I was typing (not just when I went to another line). For me, it seemed to be related to a Microsoft Web Browser control that I had in an open workbook. When I took out the web browser, the VBA editor started acting normally again. I have no idea why that worked, but it did. Now I avoid using that control in my workbooks.


I had this exact problem and the following worked for me.

  1. Click the Microsoft Office Button, and then click Excel Options
  2. Click the Add-Ins category
  3. In the Manage box, click COM Add-ins, and then click Go.
  4. Look for an add in called 'Load Test Report AddIn' then uncheck it
  5. restart excel

This addin is installed with VS2010 Beta2


In Excel 2010, toggling Design Mode button on the Developer Ribbon Tab solves the problem for me.


Something is causing your spreadsheet to recalculate while you are in the VBA Editor and this 'compiles' your code and thus strips the spaces. You need to stop the cells recalculating while you are editing. Turning the calculation to manual in the spreadsheet. Tools > Options > Calculation should do the trick.

I noticed this when I had cells recalculating thanks to a DDE connection.

Tags:

Editor

Excel

Vba