[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] CreateWorkbooks()
[color=darkblue]Dim[/color] strMyPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] wkbNew [color=darkblue]As[/color] Workbook
[color=darkblue]Dim[/color] wksNew [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] rUniqueVals [color=darkblue]As[/color] Range
[color=darkblue]Dim[/color] rCell [color=darkblue]As[/color] Range
[color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] LastColumn [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]With[/color] ActiveSheet.UsedRange
LastRow = .Rows.Count + .Rows(1).Row - 1
LastColumn = .Columns.Count + .Columns(1).Column - 1
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]If[/color] LastRow > 1 [color=darkblue]Then[/color]
Application.ScreenUpdating = [color=darkblue]False[/color]
strMyPath = "C:\Users\Domenic\Desktop\"
[color=darkblue]If[/color] Right(strMyPath, 1) <> "\" [color=darkblue]Then[/color] strMyPath = strMyPath & "\"
[color=darkblue]With[/color] Range(Cells(1, 1), Cells(LastRow, LastColumn))
.Sort key1:=Range("E1"), Order1:=xlAscending, Header:=xlYes, _
ordercustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
[color=darkblue]End[/color] [color=darkblue]With[/color]
Range("E1:E" & LastRow).AdvancedFilter xlFilterInPlace, , , [color=darkblue]True[/color]
[color=darkblue]Set[/color] rUniqueVals = Range("E2:E" & LastRow).SpecialCells(xlCellTypeVisible)
[color=darkblue]For[/color] [color=darkblue]Each[/color] rCell [color=darkblue]In[/color] rUniqueVals
[color=darkblue]With[/color] ActiveSheet.UsedRange
.AutoFilter field:=5, Criteria1:=rCell.Value
.Copy
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]Set[/color] wkbNew = Workbooks.Add(xlWBATWorksheet)
[color=darkblue]Set[/color] wksNew = wkbNew.Worksheets(1)
wksNew.Range("A1").PasteSpecial
wkbNew.SaveAs strMyPath & rCell.Value & ".xlsx", 51
wkbNew.Close [color=darkblue]False[/color]
[color=darkblue]Next[/color] rCell
ActiveSheet.ShowAllData
Application.ScreenUpdating = [color=darkblue]True[/color]
MsgBox "Completed...", vbInformation
[color=darkblue]Else[/color]
MsgBox "No data is available...", vbExclamation
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]