Comments

Comments are use basically notes which are used to increase the readability of the code. Comments does not execute while running a code. We also can disable the some part of code by using the comments.

IF we put Single Quotation mark  (‘) or “Rem” keyword before a code line then it will become a comment.

Sub test1()

'this is a comments

Rem this is a comments

Dim t As Long

t = 40000


End Sub

We can comments multiple line together by using Edit window in Visual basic editor.

To open the edit window in Visual Basic Editor- Go to View>>Toolbars>>Edit

Show Edit Window option
Show Edit Window option

Below given window will be displayed

Edit Window in Visual Basic Editor
Edit Window in Visual Basic Editor

Select the multiple line you your code and click on Comments Block button (highlighted in below image)

Comments multiple lines
Comments multiple lines

Selected line will be Comments and will not be executed during the code execution.

Selected line has been comments
Selected line has been comments

To Uncomments select the lines and click on Uncomments Block button (highlighted in below image)

Uncomments Multiple line
Uncomments Multiple line

Selected line will be Uncomments and will be executed during the code execution.

Next Chapter>>Input Box and Message Box