how to merge two ranges

  • Thread starter Thread starter sunilpatel
  • Start date Start date
S

sunilpatel

I have

dim fields1, fildes2, fields3 as range

i want to do set fields3=fields1+fields2
fields3.select

how do i do this in code?
 
Hi,

When you dim ranges note how i've done it otherwise you range is dimensioned
as Variant

Dim fields1 As Range, fields2 As Range, fields3 As Range
Set fields1 = Range("A1:A10")
Set fields2 = Range("C1:C10")

Set fields3 = Union(fields1, fields2)
fields3.Select

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top