{"id":14695,"date":"2018-04-02T17:36:47","date_gmt":"2018-04-02T17:36:47","guid":{"rendered":"http:\/\/learnexcelmacro.com\/wp\/?p=14695"},"modified":"2022-08-17T19:18:11","modified_gmt":"2022-08-17T19:18:11","slug":"how-to-comment-a-line-or-group-of-lines-in-excel-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2018\/04\/how-to-comment-a-line-or-group-of-lines-in-excel-vba\/","title":{"rendered":"3 Methods to Comment or Uncomment in Excel VBA"},"content":{"rendered":"
[et_pb_section fb_built=”1″ admin_label=”section” _builder_version=”4.16″ da_disable_devices=”off|off|off” global_colors_info=”{}” da_is_popup=”off” da_exit_intent=”off” da_has_close=”on” da_alt_close=”off” da_dark_close=”off” da_not_modal=”on” da_is_singular=”off” da_with_loader=”off” da_has_shadow=”on”][et_pb_row admin_label=”row” _builder_version=”4.16″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” global_colors_info=”{}”][et_pb_column type=”4_4″ _builder_version=”4.16″ custom_padding=”|||” global_colors_info=”{}” custom_padding__hover=”|||”][et_pb_text _builder_version=”4.17.6″ _module_preset=”default” global_colors_info=”{}”]Dear Friends,<\/p>\n
This is a very simple yet useful article, especially for beginners. Sometimes even intermediate-level users also do not know about all these options to comment on a line or group of lines in Excel VBA.<\/p>\n
Like every other programming language, VBA too has an option to comment on a line or group of lines in your code. Commenting a line or group of lines in any programming language means – to instruct the execution control or compiler to skip those lines from compilation or execution. <\/em><\/p>\n Before I tell you how to comment on a line in Excel VBA, let me explain to you – the use of it<\/p>\n As mentioned above these comments is something that is not compiled or executed, a programmer can write anything in any simple human language to give a brief description of a function, a variable, a statement, etc. It is not MANDATORY but a good programming practice to provide proper comments so that any other programmer can easily understand the code easily.<\/p>\n<\/div>\n Basically, there are 3 ways to do so. <\/p>\n This is one of the simplest methods to comment on a single line in VBA programming.
\nFor those who does not know – what is comment in a Programming:<\/em><\/span><\/p>\nWhat is the use of comments in Excel VBA Programming<\/h2>\n
\nThis makes the programmer’s life easier from a maintenance perspective. By reading those brief descriptions of the code, any programmer can have a basic idea of what that function or statement or variable, etc. does.<\/p>\nHow to comment a single line in VBA code <\/h1>\n
Method 1: Using Single Quote (‘) <\/h2>\n
\nTo comment on a line, you can simply type a single quote (‘)<\/span> at the beginning of that line. The whole line will turn into green text. That’s all!
\nNow that line would neither be compiled nor executed. <\/p>\n