Step 3: Once we double click on the module we can see the code window. Module in VBA is where we write our blocks of codes. Step 2: Now once we are in VBA we need to insert a module. Step 1: As we discussed above in order to enter VBA we need to go to the Developer tab and click on Visual Basic to open VBA Editor. Now let use the first method which is a very simple one using the single quote.
You can download this VBA Block Comment Excel Template here – VBA Block Comment Excel Template VBA Block Comment – Example #1 Comment a Block of Code in Excel VBAīelow are the three processes to comment a block of code in Excel VBA and they are as follows: Developer’s tab can be enabled from the files tab in the options section. Now I have explained the methods to block comments in VBA now let us use them in examples and try them.īut first, ensure that you have a developer’s tab enabled in order to use VBA. REM keyword changes any statement into a comment in VBA. The third option is also a very easy option, it is to use the REM keyword.
The second option is an inbuilt feature in VBA which needs to be activated which can comment or uncomment a block of words.The first option is the very simple one, we write any statement in a single quote (‘) it automatically becomes a comment in VBA.But first, let me explain what these options are and how they work.
Now there are three options in VBA to put comments in blocks of codes. Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more. It will also help him understand what a certain function or a block of code does. For example, if I write a function to add two numbers I can write a comment “Addition of two numbers” which will help me in the near future when I need to reevaluate the code or any other programmer looks at my code. Comments are only there to help any other user or oneself while debugging to remember which code is for what. Comments in VBA will not be executed or compiled with the other codes. Now we know what a block comment means, in this article, we will learn about various ways of commenting on any block of codes in VBA. Well in VBA, comment block is not enabled by default, we have to do it ourselves.
Commenting on a block of codes which is a fundamental feature of any programming language. This is not the only case for VBA be it any programming language. Just a single glance will not provide immediate attention on which function is used for what. When we write codes in VBA sometimes these codes are meant for other people or other developers.