Just a newbie here, not really experienced in coding or such, instead I pulled a script from the internet to serve one purpose.
Which is to combine all the sheets in my excel file onto one single sheet where all the data will be collated. It works for some file, but at the same time, it doesn't for some, due to empty spaces in between, may I know if there is a solution to this?
Attached is my test file, any help is appreciated.
- Sub Combine()
- Dim J As Integer
- On Error Resume Next
- Sheets(1).Name = "Combined"
- Selection.Copy Destination:=Sheets(1).Range("A1")
- For J = 2 To Sheets.Count
- Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
- Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
- End Sub