In a macro there will be lot of codes and a lot of sections. It is very much possible for you to develop or modify it in future. To develop the specific code you need to find and go to that line. If you use a Macro Comment, you can easily understand why this codes are written for. And easily find the target code with the help of comments and edit or develop it.
Macro Comments and simple code written in Excel VBA. It is not for execute with others Excel VBA Code. It is just for taking a note, that what is the code for. It is becomes more useful while your codes increases more. You can use multiple comments. It is very easy to Deleting or Writing.
Example:
After running the above program, the active sheet will display 2 names like below:
Way of Using Macro Comments:
There are to ways to use the Macro Comments in Excel VBA. These are:
a) Using an Apostrophe (') symbol: An " ' " (apostrophe) is used at the beginning of the line to start writing the Macro Comments.
b) Using the toolbar: Select the text which you want to mark as comments, and then Click on Comment Block button from Edit Toolbar in Excel VBA Environment.
If your VBA Environment Edit Toolbar is not present in toolbar, then follow the below steps to activate it:
(1) Right Click on Toolbar and Click on Edit to activate the Edit toolbar.
It will display the Edit Toolbar:
Save the file as .xlsm and exit for today.
Macro Comments and simple code written in Excel VBA. It is not for execute with others Excel VBA Code. It is just for taking a note, that what is the code for. It is becomes more useful while your codes increases more. You can use multiple comments. It is very easy to Deleting or Writing.
Example:
Sub comments_writing1() 'This is a test of displaying 2 words the cell A1 and cell B1 in active sheet Range("A1").Value = "Messi" Range("B1").Value = "Ronaldo" End Sub
After running the above program, the active sheet will display 2 names like below:
Image 1: Macro Comments marked as Red Arrow
Way of Using Macro Comments:
There are to ways to use the Macro Comments in Excel VBA. These are:
a) Using an Apostrophe (') symbol: An " ' " (apostrophe) is used at the beginning of the line to start writing the Macro Comments.
b) Using the toolbar: Select the text which you want to mark as comments, and then Click on Comment Block button from Edit Toolbar in Excel VBA Environment.
Image 2: Comment Block tool
If your VBA Environment Edit Toolbar is not present in toolbar, then follow the below steps to activate it:
(1) Right Click on Toolbar and Click on Edit to activate the Edit toolbar.
Image 3: Activating the Edit toolbar on Right Clicking in VBA Environment
It will display the Edit Toolbar:
Image 4: Edit Toolbar
Save the file as .xlsm and exit for today.