View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Table of Contents for Excel File

What does the '_' do

The "_" doesn't do anything in terms of changing the functionality of the
code. It simply allows you to write a single logical line of code across two
or more physical lines of code. For example,

Range( _
"A1" _
) _
..Value _
= _
123

is interpreted by VBA as if it were written on a single line:

Range("A1").Value = 123

Note that there must be a space before the underscore character.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"akafrog18" wrote in message
oups.com...
Thanks Paul. That did work. What does the '_' do that allows it to
work correctly? I had tried using the Or and And several times but
always ended up with a Run Time Error.

Thanks