Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does VBA contain a comment block syntax? [duplicate]

In VBA is there a short way to comment out a block of code the same way java uses /*...*/?

like image 926
Tim.DeVries Avatar asked Jun 02 '14 19:06

Tim.DeVries


People also ask

What is a comment in VBA?

A VBA COMMENT is a green line of text that helps you to describe the written code. In simple words, a comment is a line of text which is not a code and VBA ignores it while executing the code.


2 Answers

Although there isn't a syntax, you can still get close by using the built-in block comment buttons:

If you're not viewing the Edit toolbar already, right-click on the toolbar and enable the Edit toolbar:

enter image description here

Then, select a block of code and hit the "Comment Block" button; or if it's already commented out, use the "Uncomment Block" button:

enter image description here

Fast and easy!

like image 125
LimaNightHawk Avatar answered Sep 18 '22 15:09

LimaNightHawk


prefix the comment with a single-quote. there is no need for an "end" tag.

'this is a comment 

Extend to multiple lines using the line-continuation character, _:

'this is a multi-line _    comment 

This is an option in the toolbar to select a line(s) of code and comment/uncomment:

enter image description here

like image 41
David Zemens Avatar answered Sep 17 '22 15:09

David Zemens