Hello:hi:! There is a table (A1) on the sheet "1" and the table(A1) on the sheet "2", how to merge them on the sheet "3"? Tables only with one column.
: pray2:
Printable View
Hello:hi:! There is a table (A1) on the sheet "1" and the table(A1) on the sheet "2", how to merge them on the sheet "3"? Tables only with one column.
: pray2:
welcome to the forum.
an easy to understand approach to copy one column could be:
for multiple columns, for ex 6 columns A:F, you can use "A2:F" instead of "A2:A".Code:Sub merge_wss()
Worksheets("Sheet3").Cells.Clear 'clear previous data
Worksheets("Sheet1").Range("A1").Copy Worksheets("Sheet3").Range("A1") 'copy header
Worksheets("Sheet1").Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).Copy _
Worksheets("Sheet3").Cells(Rows.Count, "A").End(xlUp).Offset(1)
Worksheets("Sheet2").Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).Copy _
Worksheets("Sheet3").Cells(Rows.Count, "A").End(xlUp).Offset(1)
End Sub
I tried and received it:
==============
Sheet1
==============
Name
1
2
3
4
==============
Sheet2
==============
Name
5
6
7
8
==============
Sheet3
==============
Name
Name
1
2
3
4
Name
5
6
7
8
___________________
Shall be
==============
Sheet3
==============
Name
1
2
3
4
5
6
7
8
same data, same code.
download and test attachment.
Hmm, really everything works. Probably, something went wrong. Thank you.