Monday, February 16, 2015

How to use comments in the Excel VBA Macro ?

Adding macro comments to the Excel VBA code will make it easy to read the complex programs, which have long codes.

The macro comment is an text line created in a macro which will not be executed by the Excel VBA. It is only there to provide you information about the macro. To let Excel VBA know that it is a comment, place an apostrophe at the start of the text. Execute the following steps to place a comment.

1. Launch the Visual Basic Editor.
2. Insert the line: 'Place the word Hello into cell A1' before the code line. After the line is inserted, Excel VBA colors the line green to indicate that it is a comment.



Macro comments become more useful as our program size increases, and we need to remember the information and recall when needed with the help of comments.

2 comments:

  1. The information you have posted is very useful. The sites you have referred was good. Thanks for sharing...
    excel vba courses

    ReplyDelete