How to comment and uncomment blocks of code in the Office VBA Editor

In the VBA editor, go to ViewToolbarsCustomise... or right click on the tool bar and select Customise...

Under the Commands tab, select the Edit menu on the left.

Then approximately two thirds of the way down there’s two icons, Comment Block and Uncomment Block.

Drag and drop these onto your toolbar and then you have easy access to highlight a block of code, and comment it out and uncomment with the click of a button!


See GauravSingh’s answer if you want to assign keyboard shortcuts.

Leave a Comment