What does undersocre line mean

  • Thread starter Thread starter Grace
  • Start date Start date
G

Grace

In a lot of these macros, I see an underscore "_" symbol. What does it
connote?

G
 
Grace,

That is a line continuation character, which is used to write one
logical line of code on several actual lines of code in the file.
It is used on long lines of code to make to make the code more
readable.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
When it's used at the end of a line it is a line-continuation character
It means that the code on that line and the line that follows i
treated as though it is on the same line. I't is for asthetic reason
as it makes code easier to read. At least it does when it is use
properly. - Piku
 
Grace

you can't have spaces in labels and variable names, etc. Using an
underscore is a common way of "breaking up" the variables to make them more
readable. Some people use capital letters as another option.

So, if you had a macro that you wanted to call "copy data from sheet 1 to
sheet 2" you could write:

Sub copy_data_from_sheet_1_to_sheet_2()

or

Sub Copy_Data_From_Sheet_1_To_Sheet_2()

or

Sub CopyDataFromSheet1ToSheet2()

Regards

Trevor
 
Grace

You are breaking up one line of code into more than one line to make it
easier to read. So....

Range(Range("A1"), Range("A" & Rows.Count).End(xlUp)).Select

is the same as

Range(Range("A1"), _
Range("A" & Rows.Count).End(xlUp)).Select

--
XL2002
Regards

William

(e-mail address removed)

| In a lot of these macros, I see an underscore "_" symbol. What does it
| connote?
|
| G
|
|
 
Hi G

It (a space plus an underscore) wraps a long line, meaning something like
"this is not a line break". As in

Hi _
G

One does this
1) because one can not afford a super widescreen display on a developer
salary;
2) because newsgroup postings break long lines automatically, making
copy-paste code err.

HTH. Best wishes Harald
 
Wow, I sure got a lot of help on this one. Can I ask any of you to look at
the reply I sent on "can it be done" and see if any of you can answer any
(doesn't have to be all) of that?

Thanks, _
Grace
 
You have another reply there.
Wow, I sure got a lot of help on this one. Can I ask any of you to look at
the reply I sent on "can it be done" and see if any of you can answer any
(doesn't have to be all) of that?

Thanks, _
Grace
 

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