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

后端 未结 9 816
醉酒成梦
醉酒成梦 2020-12-02 04:21

In the VBA editor of Office (ALT + F11), how do you comment or uncomment a block of code?

9条回答
  •  清歌不尽
    2020-12-02 04:41

    In the VBA editor, go to View, Toolbars, Customise... 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.

提交回复
热议问题