View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban Alan Beban is offline
external usenet poster
 
Posts: 200
Default Is there a built-in function to combine 2 ranges?

Not sure what you mean by "built-in functions" in this context, but how
about

Set rng3 = Range(rng1(1, 1), rng2(rng2.Rows.Count, rng2.Columns.Count))

Alan Beban

Nick Hebb wrote:
Before you answer Union(), read on...

I need a function to combine 2 ranges that return 1 range encompassing
both.

Given,
range1 = "A1:D10"
range2 = "C5:F23"

Union(range1, range2) would return "A1:D10,C5:F23", but I want
something that returns "A1:F23".

I could probably write something in a few minutes, but I prefer built-
in functions where possible.

Thanks,

Nick Hebb
BreezeTree Software
http://www.breezetree.com