Selecting multiple ranges
set rng2 = Intersect(Range("U:U,Y:Y,AC:AC,AG:AG,AK:AK"),Range ("2:12"))
? rng2.Address(0,0)
U2:U12,Y2:Y12,AC2:AC12,AG2:AG12,AK2:AK12
Sub BBB()
Dim rng As Range, rng1 As Range
Set rng = Range("U2:U12")
Set rng1 = rng
For i = 1 To 4
Set rng = Union(rng, rng1.Offset(0, i * 4))
Next
Debug.Print rng.Address(0, 0)
End Sub
also produces
U2:U12,Y2:Y12,AC2:AC12,AG2:AG12,AK2:AK12
--
Regards,
Tom Ogilvy
"RWN" wrote in message
...
I want to select multiple contiguous row ranges in non-contiguous columns
but can't seem
to figure it out.
The macro recorder equivalent is
Range("U2:U12,Y2:Y12").Select
This is an abbreviation of what I want as I'm trying to select five ranges
in all.
From the VBA "Help" it appears as if I'd have to use "Union", is there
another way (or
I'll have a statement that will go on forever!)?
--
Regards;
Rob
------------------------------------------------------------------------
|