Hector,
That is a text string you are breaking up.
You need quote marks around each segment.
Using just line breaks won't work.
"This is a very long text string" can be split into three lines this way...
"This is a very " & _
"long " & _
"text string"
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
"Hector Fernandez"
<(E-Mail Removed)>
wrote in message
I am trying to perform a single event to multiple ranges but for some
reason I can't get the macro to work if I write it on multiple lines.
If, for example, I write:
Sub Clear_Ranges()
Range("range1,range2,range3") = clear
End Sub
The macro works just fine and clears the ranges. However, if I do the
following:
Sub Clear_Ranges()
Range("range1, _
range2, _
range3") = clear
End Sub
I get an error message "Compile Error: Expected: List separator or )"
I thought that using a space and underscore was suppose to allow you to
write a single line of code across several lines in order to make it
easier to read or fit in a page.
I intend to have a lot more than three ranges in the macro and it will
be very messy and long if I try to put it on a single line.
What am I doing wrong?
Is there an easier way to perform the same thing on several different
ranges?
Thanks.