Don Guillett
12/17/2006 2:42:00 PM
Usually but it appears, in this case, no. So, just make several lines..
Range("range1,range2,range3") = clear
Range("range4,range5,range6") = clear
Of course, if contiguos, not necessary.
range("a2, c2:f2 ,l2")
--
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
"Hector Fernandez" <public.research@gmail.com> wrote in message
news:1166365184.592178.236300@j72g2000cwa.googlegroups.com...
>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.
>