Try this code. It will copy your header line and all the relevant lines.
Sub AddSheet()
Application.ScreenUpdating = False
Dim bottomT As Integer
bottomT = Range("T" & Rows.Count).End(xlUp).Row
Dim rng As Range
Dim rgn2 As Range
Dim ws As Worksheet
For Each rng In Range("T2:T" & bottomT)
Set ws = Nothing
On Error Resume Next
Set ws = Worksheets(Left(rng.Value, 15) & "-" & Left(rng.Offset(0, -9), 10))
On Error GoTo 0
If ws Is Nothing Then
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = Left(rng.Value, 15) & "-" & Left(rng.Offset(0, -9), 10)
Sheets("All data mod new").Range("A1:AH1").Copy ActiveSheet.Cells(1, 1)
For Each rng2 In Sheets("All data mod new").Range("T2:T" & bottomT)
If Left(rng2.Value, 15) & "-" & Left(rng2.Offset(0, -9), 10) = ActiveSheet.Name Then
rng2.EntireRow.Copy ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
End If
Next rng2
End If
Next rng
Application.ScreenUpdating = True
End Sub
Bookmarks