Hi,
I am not that experienced in VBA, so there probably is a quicker method.
Try this. The second sub is to find a block of data if it does not start in the a1 cell.
Irvy
Code:
Sub integrate()
'Add a new sheet
Set newSht = Sheets.Add
newSht.Name = "All"
Set newRg = [a1]
'Go through all sheets and skip the new sheet named
For Each sht In Worksheets
If sht.Name = "All" Then GoTo skip
sht.Activate
If sht.Cells(1, 1) = "" Then
findFirstCell(sht.Cells).Select
Set rg = ActiveCell.CurrentRegion
Set newRg = newSht.[a1].CurrentRegion
Range(rg(2, 1), rg(rg.Rows.Count, rg.Columns.Count)).Copy newRg(newRg.Rows.Count + 1, 1)
End If
skip:
Next
End Sub
Function findFirstCell(InRange As Range) As Range
'This finds the start of the first block of data on the sheet.
Dim C As Long, R As Long
R = InRange.Rows.Count
C = InRange.Columns.Count
For i = 1 To InRange.Columns.Count
Set findFirstCell = InRange.Cells(1, i).End(xlDown)
If findFirstCell.Row < R Then
Exit Function
Else
Set findFirstCell = InRange.Cells(i, 1).End(xlToRight)
If findFirstCell.Column < C Then
Exit Function
End If
End If
Next
Set findFirstCell = InRange.Cells(1, 1)
End Function