Commenting in Code

  • Thread starter Thread starter Paul Black
  • Start date Start date
P

Paul Black

Hi Everyone,

I know that if you want to put a Comment Next to a Bit of Code you use
"'".
I have a Program where I have Written a Description of what the Bit of
Code Below it does. I use the "'" Before Starting my Description, But
when I Copy it into a Module it puts Speach Marks at the Beginning
which Causes an ERROR. Is it something to do with the Fact that I use
the Next Line Command ( Alt & ENTER ) in the Excel Cell which I am
Commenting.
Thanks in Advance.

All the Best
Paul
 
Hi Paul:

Try :
' This is the first line of my comment _
' This is the second

Good Luck
TK
 
the single quote only mark from that point to the end of the line as a
comment. for multiline comments, each line has to start with a single
quote.

' * * * * * * * * * * * *
' DESCRIPTION
'
' line 1
' line 2
' line 3
' * * * * * * * * * * * *
 
Hi Paul:

Sorrow about the typo
' This is the first line of my comment
' This is the second

Use the underscore to break code into two lines

This is the first line of my code _
This is the second

Good Luck
TK
 
Thanks Everyone for your Answers.
I was just using the ', I put it in Speach Marks for the Purpose of
this Post.
I have the Code in an Excel Spreadsheet and then Copy it into the
Editor. Some of the Comments Appear to be on 4 or 5 Lines in a Single
Excel Cell Because I have Used the New Line Command in Excel ( Alt +
Enter ) while Writing the Descriptions. I think that it is this that
when I Copy it into the Editor it puts a Speach Mark at the Beginning
Causing the Line to Turn Red.

In a Single Excel Cell it Looks like this :-
' Start of Comments
' Next Line
' Next Line etc

But in the Editor it Looks like this :-
" ' Start of Comments
' Next Line
' Next Line etc

I Just Wondered if there was a way Round this Instead of putting the
Comments on Several Lines in Excel.

Thanks in Advance
Paul
 
I'm confused as to what you actually want.

Comments in the VB Editor can use line continuations.

eg.
' This is line 1 _
Comment of line 2 _
Last line of the same comment
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top