Does VBA contain a comment block syntax? [duplicat

2019-06-14 22:33发布

This question already has an answer here:

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

3条回答
你好瞎i
2楼-- · 2019-06-14 23:04

There is no syntax for block quote in VBA. The work around is to use the button to quickly block or unblock multiple lines of code.

查看更多
Evening l夕情丶
3楼-- · 2019-06-14 23:05

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!

查看更多
Viruses.
4楼-- · 2019-06-14 23:12

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

查看更多
登录 后发表回答