hi try dis code
Sub test()
With ThisWorkbook
Do Until .Sheets(1).Columns(4).SpecialCells(2).Count = 1
c01 = .Sheets(1).Cells(2, 4).Value
Workbooks.Add
With .Sheets(1).Cells(1).CurrentRegion
.AutoFilter 4, c01
.Copy ActiveWorkbook.Sheets(1).Cells(1)
ActiveWorkbook.Activate
For Each ccell In Sheets(1).Range("E1:n1")
ccell.Value = Range("D2").Value & ccell.Value
Next ccell
Sheets(1).Range("E1:N1").Columns.AutoFit
.Offset(1).EntireRow.Delete
.AutoFilter
End With
ActiveWorkbook.SaveAs .Path & "\" & c01, .FileFormat
ActiveWorkbook.Close False
Loop
End With
End Sub
Bookmarks