Try this....
Code:
Sub DistributeRows()
Dim wbNew As Workbook
Dim wsData As Worksheet
Dim wksTransDet As Worksheet
Dim wsCrit As Worksheet
Dim wsNew As Worksheet
Dim rngCrit As Range
Dim LastRow As Long
Set wsData = Worksheets("LOAD DATA")
Set wksTransDet = Worksheets("Trans Detail")
Set wsCrit = Worksheets.Add
LastRow = wsData.Range("A" & Rows.Count).End(xlUp).Row
wsData.Range("A1:A" & LastRow - 1).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=wsCrit.Range("A1"), Unique:=True
Set rngCrit = wsCrit.Range("A2")
While rngCrit.Value <> ""
Set wbNew = Workbooks.Add(xlWorksheet)
wbNew.Sheets.Add
wsData.Range("A1:AH" & LastRow).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=rngCrit.Offset(-1).Resize(2), CopyToRange:=wbNew.Sheets(1).Range("A1"), Unique:=True
wksTransDet.Range("A95:R" & wksTransDet.Cells(Rows.Count, 1).End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=rngCrit.Offset(-1).Resize(2), CopyToRange:=wbNew.Sheets(2).Range("A1"), Unique:=True
With wbNew
.Sheets(1).Name = rngCrit
.Sheets(2).Name = rngCrit & "-2"
.SaveAs ThisWorkbook.Path & "\" & rngCrit & "-" & Format(Date, "dd mmm yy")
.Close SaveChanges:=True
End With
rngCrit.EntireRow.Delete
Set rngCrit = wsCrit.Range("A2")
Wend
Application.DisplayAlerts = False
wsCrit.Delete
Application.DisplayAlerts = True
Set wbNew = Nothing
Set wksTransDet = Nothing
Set wsData = Nothing
End Sub
Bookmarks