{"id":4458,"date":"2015-12-22T21:52:55","date_gmt":"2015-12-22T21:52:55","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/wp\/?p=4458"},"modified":"2018-04-02T16:56:16","modified_gmt":"2018-04-02T16:56:16","slug":"comment-uncomment-vba-code","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/","title":{"rendered":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA"},"content":{"rendered":"

\"comment
\nDear Friends,<\/p>\n

Providing proper short descriptions for each of your functions or statements etc. makes your VBA code – easy to read, easy to understand by anyone who refers your code. <\/p>\n

Now the question is, how can you write description in English language in between your VBA code? VBA compiler will start giving compile error<\/a>. It is very simple by commenting those lines which you do not want get executed.<\/p>\n

How to comment a line in VBA code <\/h2>\n

In VBA to comment a particular line which you do not want to get compiled or executed, you can type your line followed by single quote ( ‘ )<\/strong>. The complete line which is starting with single quote is ignored and does not get executed. All the commented lines get formatted in green color as shown below image.
\n

\"Commented

Commented line<\/p><\/div><\/p>\n

\nIt means to comment a block of code or lines you need to put single quote for each lines. It becomes difficult if you have got a function of hundreds of lines of code which you want to comment. then how to comment them all in simple way??<\/p>\n

How to comment a block of codes or lines in VBA<\/h2>\n

In order to comment a block of lines at once, follow the below steps:<\/p>\n

1. Select the Block which you want to comment
\n2. Click on comment Block option available as shown in below picture:<\/p>\n

\"Commenting

Commenting Block of codes in VBA<\/p><\/div>\n

How to uncomment a block of codes or lines in VBA which are already commented<\/h2>\n

In order to un-comment a block of lines at once, follow the below steps:<\/p>\n

1. Select the Block which you want to uncomment
\n2. Click on the un-comment Block option available as shown in below picture:<\/p>\n

\"Uncomment

Uncomment block of comment<\/p><\/div>\n

Where to find this comment Block Option in VBA window<\/h2>\n

Follow the below steps to enable or see this comment block option in VBA window:<\/p>\n

1. To make this option visible follow : View –> Toolbars –> Click on Edit<\/strong><\/p>\n

\"Comment

Comment Block Option<\/p><\/div>\n<\/span>","protected":false},"excerpt":{"rendered":"

Dear Friends, Providing proper short descriptions for each of your functions or statements etc. makes your VBA code – easy to read, easy to understand by anyone who refers your code. Now the question is, how can you write description in English language in between your VBA code? VBA compiler will start giving compile error. […]<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1246,1679,1675,1676],"tags":[],"class_list":["post-4458","post","type-post","status-publish","format-standard","hentry","category-macro","category-excel-macro-beginner","category-excel-macro-for-beginners","category-excel-tips"],"yoast_head":"\nExcel VBA Tips: How to comment or uncomment a Block of Code in VBA - Let's excel in Excel<\/title>\n<meta name=\"description\" content=\"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA\" \/>\n<meta property=\"og:description\" content=\"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-22T21:52:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-04-02T16:56:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/learnexcelmacro.com\/wp\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA\",\"datePublished\":\"2015-12-22T21:52:55+00:00\",\"dateModified\":\"2018-04-02T16:56:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\"},\"wordCount\":378,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg\",\"articleSection\":[\"Excel Macro\",\"Excel Macro Beginner\",\"Excel Macro Tutorial\",\"Excel Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\",\"name\":\"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA - Let's excel in Excel\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg\",\"datePublished\":\"2015-12-22T21:52:55+00:00\",\"dateModified\":\"2018-04-02T16:56:16+00:00\",\"description\":\"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA - Let's excel in Excel","description":"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/","og_locale":"en_US","og_type":"article","og_title":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA","og_description":"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window","og_url":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2015-12-22T21:52:55+00:00","article_modified_time":"2018-04-02T16:56:16+00:00","og_image":[{"url":"http:\/\/learnexcelmacro.com\/wp\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA","datePublished":"2015-12-22T21:52:55+00:00","dateModified":"2018-04-02T16:56:16+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/"},"wordCount":378,"commentCount":1,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg","articleSection":["Excel Macro","Excel Macro Beginner","Excel Macro Tutorial","Excel Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/","url":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/","name":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA - Let's excel in Excel","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage"},"image":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage"},"thumbnailUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg","datePublished":"2015-12-22T21:52:55+00:00","dateModified":"2018-04-02T16:56:16+00:00","description":"This article focuses on how to comment lines or blocks of codes in VBA. It also explains about uncommenting the block of codes or VBA lines. How to make comment block option in VBA window","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#primaryimage","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2015\/12\/code-in-comments.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2015\/12\/comment-uncomment-vba-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"Excel VBA Tips: How to comment or uncomment a Block of Code in VBA"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/x.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4458"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=4458"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4458\/revisions"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=4458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=4458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=4458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}