VBA - Commenting code for Readability


Different programming languages have different methods for entering comments.
For VBA comments are anything that follows a single inverted comma.

Comments are key for creating code that is readable and easy to update.

As you learn to program you will create more complex programs that can be difficult to maintain. Inserting comments as you create the code can save you a lot of time in the future.

Comments are often used when developing code to stop a line from running. This allows you to quickly add and subtract chunks of code. Though once you are happy - remember to clean up the comments.  

VBA has an option to comment multiple line at once. To do this the edit toolbar needs to be activated. This is be default turned off. To turn it on - right click the toolbar and select edit. 

This will create additional options. These two are the ones that comment out a block of code and also un-comment a block of code. 

Related Sections

Python - Learn the python from the basics up. This fast track example code course will get you creating powerful python programs in no time.

Must Read Articles

VBA and Microsoft Excel - Getting the most out of excel with VBA programming
VBA and Microsoft Word - Getting the most out of word with VBA programming
Application Object - Using the applications features in your code.
Installing VBA and First Program - What do you need to start using visual basic application VBA.