Used to include explanatory remarks in a program.
The argument remark is the text of any comments you want to include in your program. Spaces and punctuation are permitted. Comment text appears exactly as entered when the program is listed. You can use comments to document how your code works or to provide any other information with your code.
If you use line numbers Execution continues with the first executable statement following the Rem statement. or line labels , you can branch from a GoTo or GoSub statement to a line containing a Rem statement.
As shown in syntax 2, you can use a single quotation mark (apostrophe) instead of the Rem reserved word If the Rem reserved word follows other statements on a line, it must be separated from the statements by a colon. However, when you use a single quotation mark, the colon is not required after other statements..
Rem Statement Example
The example illustrates the various forms of the Rem statement syntax. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Msg1, Msg2 ' Declare variables.
Rem This is the first form of the syntax.
' This is the second form of the syntax.
Msg1 = "Hello" : Rem Comment after a statement separated by a colon.
Msg2 = "Goodbye" ' Second form after a statement without a colon.
MsgBox "This example illustrates Rem statement syntax."