ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Commenting in Code (https://www.excelbanter.com/excel-programming/312811-commenting-code.html)

Paul Black

Commenting in Code
 
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

No Name

Commenting in Code
 
hi,
try using just ' instead of "'".

-----Original Message-----
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
.


Frank Kabel

Commenting in Code
 
Hi Paul
use the apostophe for this: '

--
Regards
Frank Kabel
Frankfurt, Germany

"Paul Black" schrieb im Newsbeitrag
...
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



TK

Commenting in Code
 
Hi Paul:

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

Good Luck
TK

"Paul Black" wrote:

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


Tom Ogilvy

Commenting in Code
 
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
' * * * * * * * * * * * *

--
Regards,
Tom Ogilvy


"Paul Black" wrote in message
...
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




TK

Commenting in Code
 
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

"TK" wrote:

Hi Paul:

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

Good Luck
TK

"Paul Black" wrote:

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


Paul Black

Commenting in Code
 
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

Rob van Gelder[_4_]

Commenting in Code
 
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


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Paul Black" wrote in message
...
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





All times are GMT +1. The time now is 04:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com