I know this question has been asked several times, but no solution seemed to work for me. I have a large Workbook with data on 50 companies, spread across 50 worksheets.
My goal is to combine everything into a large "Combined" sheet, including all the data. However, the data on the worksheets sometimes has blanks. Also my code does not have a common header. Instead the first row is always the company name which should also be transferred to the combined sheet.
See my screenshot below:
I tried the below code but it only combined the headers.
Sub Combine()
Dim J As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub
Running the code gives me only the header line, but not the rest of the data.
See result:
Any suggestions would be highly appreciated, thanks!