Merge two sheets into an existing sheet with Macro

shoemaro

New Member
Joined
Sep 11, 2015
Messages
1
I need a macro two combine two separate sheets into an existing sheet in the same workbook. Sheet 1 i need all contents copied and pasted into a combined sheet. Sheet two I need all data excluding the top row. For each sheet I need columns A:K. I have a macro that works, but it creates a new sheet for the combined data, I need the combined data to be on an existing sheet in the same workbook. I have included the macro I have been using below. Any help appreciated. Thanks

Sub Collate_Sheets()

Sheets.Add After:=Sheets(Sheets.Count)
Dim wks As Worksheet
Set wks = Sheets(Sheets.Count)
wks.Name = "Sheet3"
With Sheets("Sheet1")
Dim lastrow As Long
lastrow = .Range("K" & .Rows.Count).End(xlUp).Row
.Range("A1:K" & lastrow).Copy wks.Range("A" & wks.Rows.Count).End(xlUp)
End With
With Sheets("Sheet2")
lastrow = .Range("K" & .Rows.Count).End(xlUp).Row
.Range("A2:K" & lastrow).Copy wks.Range("A" & wks.Rows.Count).End(xlUp).Offset(1)
End With

End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Your macro adding a sheet in the beginnig.
Then you set wks to that sheet and name it Sheet3.
In your copydestination you then use that sheet as destination (wks)

To change destination to another existing sheet just change wks.range to e.g. sheets("existing").range
where existing is the name of the sheet you want to copy to.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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