How To Use Macro Comments In Excel's Vba

Oct 19, 2020 • edited Oct 21, 2020

How To Use Macro Comments In Excel's Vba

A macro comment is a piece of text in a macro which will not be executed by Excel VBA. It is only there to provide you information about the macro.

To insert a comment, execute the following steps.

1. Open the Visual Basic Editor.

2. To let Excel VBA know that you want to insert a comment, precede the text with an apostrophe.

Excel Macro Comment

Note: Excel VBA colors the line green to indicate that it's a comment. Comments become more useful as program size increases.

You can also convert multiple code lines to comments temporarily. Sometimes this is easier than deleting and rewriting them.

3. First, display the Edit toolbar. Click View, Toolbars, Edit.

4. Select the code lines.

5. Click the Comment Block button.

Comment Block button

Note: To remove the apostrophes, select the code lines and click the Uncomment Block button next to the Comment Block button.

#Tutorial#How To#VBA#Macro Errors

How to Use Loop through Books and Sheets in Excel

How To Use Mod Operator In Excel