View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Adam1 Chicago Adam1 Chicago is offline
external usenet poster
 
Posts: 9
Default Range selection with R1C1

Thanks for your help

"Jim Thomlinson" wrote:

So it is a compound range you want then... try this

union(range(cells(r1, c1), cells(r2, c2)), range(cells(r3, c3), cells(r4,
c4))).Select

It defines two ranges based on RC co-ordinates and unions those 2 ranges
together...
To see it a little more clearly you could do this

dim rng1 as range
dim rng2 as range

set rng1 = range(cells(r1, c1), cells(r2, c2))
set rng2 = range(cells(r3, c3), cells(r4, c4))
union(rng1, rng2).select
--
HTH...

Jim Thomlinson


"Adam1 Chicago" wrote:

But the suggestion below only has two Cells(r,c) which will allow me to
describe a range, but not a compound range. I would need four Cell
references (one for the start and end of each range) and that is what doesn't
seem to work.
thanks


"Jim Thomlinson" wrote:

Not too sure what exactly you want since what you want to replicate
Range("D8:F8","I8:K8").Select
is the same as
Range("D8:K8").Select
(Not a compound range???)

If you do want a compound reange then try this
union(Range("D8:F8"),Range("I8:K8")).Select
or
Union(Cells(r,c),Cells(r,c)).Select
--
HTH...

Jim Thomlinson


"Adam1 Chicago" wrote:

I would like to replicate Range("D8:F8","I8:K8").Select using R1C1 references.

Can I somehow make the Range(Cells(r,c),Cells(r,c)).Select work for a
compound range?

Thanks