One way is to manually place an apostrophe at the start of every line in the block.
A much easier way (I just found out today) is:
- Go to View-Toolbars-Customise
- Select the Command tab
- Select the Edit Category on the left
- Drag the “Comment Block” and “Uncomment Block” icons onto your toolbar.
Now you can comment (or uncomment) as many lines as you like with a single click.
The comment block buttons are a great tip, Doug.
In my own set-up I’ve gone a step further and have hotkeys for commenting / uncommenting code blocks. One could code this oneself, but I’m a big fan of MZ-Tools which lets you set up hotkeys under Tools > MZ-Tools > Options > Shortcuts. For comment block I use CTRL+K and for uncomment block I use CTRL+U, to partially match the shortcuts in Visual Studio.
LikeLiked by 2 people
Just write click on the toolbar and set Edit
LikeLiked by 2 people
This was helpful and useful AF !!
LikeLike
Colin – Thanks, I’ll have a look (I’m already an MZ-Tools user).
Fabio – yes that will work as well.
LikeLike
wow, you just found this out to day!!! its amazing what we miss. Hope your good mate.
Ross
LikeLike
Hi Ross, there are probably quite a few basic things like that I don’t know.
I blame too many years spent persevering with Lotus 123 🙂
LikeLike
This was very helpful. It’s surprising it’s not enabled by default.
LikeLike
Good tip
LikeLike
Not the answer you re looking for? Browse other questions tagged vba comments or ask your own question .
LikeLike