You can use this VBA code:
Sub copy_all()
'
' copy all sheets to D
'
Dim rowCount As Integer
Sheets("D").Select
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete
Sheets("A").Select
Range("A2").Select
Range(Selection, Selection.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("D").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("B").Select
Range("A2").Select
Range(Selection, Selection.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("D").Select
rowCount = Cells(Rows.Count, 1).End(xlUp).Row 'column A has a value of 1
Cells(rowCount + 1, 1).Select
ActiveSheet.Paste
Sheets("C").Select
Range("A2").Select
Range(Selection, Selection.SpecialCells(xlLastCell)).Select
Selection.Copy
Sheets("D").Select
rowCount = Cells(Rows.Count, 1).End(xlUp).Row 'column A has a value of 1
Cells(rowCount + 1, 1).Select
ActiveSheet.Paste
End Sub
Every time you run this macro, it's deleting all the content of sheet D
, except the column headers, and copy sheets A
, B
and C
one after the other to sheet D
.
It has 2 basic assumptions, that can be changed easily:
- The name of the sheets is
A
, B
, C
and D
. I guess this is not true, so just replace all the lines like Sheets("A").Select
by Sheets("NameOfSheet").Select
.
- The data in all sheets starts in cell
A2
. If not, simply replace all the lines like Range("A2").Select
with the correct most upper left cell of the data.
One assumption cannot be changed easily - that the data on all sheets look just the same (same number of columns, at the same order).
Try this and tell me if it helped you ;)