Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy multiple ranges

Status
Not open for further replies.

mgerard802

Technical User
Feb 4, 2003
11
US
I am trying to coy multiple named ranges, each on a different worksheet to another worksheet. Here is what I have so far, which I am running into problems with. I am getting an error when I try to copy. Any help would be appreciated. Thanks.

Private Sub Workbook_Activate()
Worksheets("ALL").Range("B3:I10000").ClearContents

Dim rGrp, rHld, Myrange As Range
Set rGrp = Worksheets("Group").Range("Grp")
Set rHld = Worksheets("Holding").Range("Hld")
Set Myrange = Union(rGrp, rHld)

Myrange.Copy Worksheets("ALL").Range("b3").PasteSpecial(xlPasteValues)


End Sub
 
You say you are getting an error when you are trying to copy, but I think you must be getting one before that where you are trying to make a union of two ranges which are on different sheets.

Your copy statement is wrong - it should be of teh form:

range.copy destination:=range_to_copy_to

But I don't think changing that will solve the whole problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top