CTRL+K,C

Comment and de-comment lines quickly in VBE
Create shortcuts inside VBE to quickly comment or de-comment selected lines.
Visual studio has CTRL+K, C and CTRL+k, U (keeping CTRL down, and pressing K then C or K then U) to comment and de-comment line or lines
VBE for VBA does not have that.
Posted on Linkedin here
https://www.linkedin.com/pulse/ctrlck-anmar-amdeen/
Also ANmar.Systems blog


Public

Tested

My Own Work
After getting used to quickly comment these lines in .NET, wanted to have the same in VBE.
The issue is that you do not see those commands in menu, only in toolbar
So we can now here add these commands to menu and assign shortcut to them too
That is what I did and I am using it since then

I used &1 since I wanted the shortcut to be ALT+E,1 for commenting, and ALT+E,2 for un-commenting

You can use any key here, just keep in mind to use something not used in the Edit menu (if you dropped it in Edit)

Hint 2020-02-03: I changed it to ALT+1 to comment and ALT+2 to uncomment by adding the captions to commands in toolbar (last screenshot), notice the 1 and 2 are underlined bcause I put their caption as &1 and &2

Views 2275 Downloads 914

VBA UI
ANmarAmdeen
744
Attachments
Revisions

v4.0