Here is my query
Sheet A has got 30 columns
Sheet B has got same headings than Sheet A but in a different order.
Is it possible to combine both sheets without having to manipulate the order of the columns?
The code below combine 2 sheets that have got the same headings in the same order. Is the re away to modify it without adding lines of extra code to rearrange the columns?
Sheet A has got 30 columns
Sheet B has got same headings than Sheet A but in a different order.
Is it possible to combine both sheets without having to manipulate the order of the columns?
The code below combine 2 sheets that have got the same headings in the same order. Is the re away to modify it without adding lines of extra code to rearrange the columns?
Code:
Sub Combine()
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add ' add a sheet in first place
Sheets(1).Name = "Combined"
' copy headings
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
' work through sheets
For J = 2 To Sheets.Count ' from sheet 2 to last sheet
Sheets(J).Activate ' make the sheet active
Range("A1").Select
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub
[\code]