Pasting from multiple ranges (union help)

Milbourn

New Member
Joined
May 27, 2014
Messages
44
Hi All,

Starter here, trying to get a macro to paste a number of cells from 2 different sheets onto a summary page.

I've looked into the Union method however I can't find any previous answers that show what to do when taking information from two different sheets. I was wondering if anyone could help? Here is what I have so far:









Code:
Sub SummaryMacro()


Sheets("SHEET 1 WORKBOOK 1").Range("c6,c9,c10,c12").Select

Selection.Copy

Workbooks.Open Filename:="C:\USER\SUMMARY PAGE"

Sheets("SUMMARY PAGE 1").Range("c7").Select

lastRow = ActiveSheet.Cells(Rows.Count, "a").End(xlUp).Row

Range("c" & Rows.Count).End(xlUp).Offset(1, 0).Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False

'Requires back to primary workbook or just sheet selection?

Sheets("SHEET 2 WORKBOOK 1").Activate

Range("E10,F10,H10,J10,K10").Select

Selection.Copy

Sheets("SUMMARY PAGE 1").Range("g7").Select

lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

Range("g" & Rows.Count).End(xlUp).Offset(1, 0).Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

End Sub
 
for the purpose of this yes there are their names.

Thank you mentioning Hyperlink.Add I believe I have found the answer for my second point.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try:

Code:
Sub SummaryMacro()
    Dim wb As Workbook
    Set wb = Workbooks.Open(Filename:="C:\USER\SUMMARY PAGE")
    With wb.Sheets("SUMMARY PAGE 1")
        ThisWorkbook.Sheets("SHEET 1 WORKBOOK 1").Range("c6,c9,c10,c12").Copy
        .Range("c" & .Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
        ThisWorkbook.Sheets("SHEET 2 WORKBOOK 1").Range("E10,F10,H10,J10,K10").Copy
        .Range("g" & .Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
    End With
    Application.CutCopyMode = False
End Sub
 
Upvote 0
That is very useful thank you, I need to learn how to code without the use of unnecessary activates and selects.

Thank you very much
 
Upvote 0

Forum statistics

Threads
1,215,428
Messages
6,124,832
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top