[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] SplitData()
[color=darkblue]Dim[/color] wksSource [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] wksDest [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] UniqueVals [color=darkblue]As[/color] Range
[color=darkblue]Dim[/color] Cell [color=darkblue]As[/color] Range
[color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
[color=darkblue]Dim[/color] Cnt [color=darkblue]As[/color] [color=darkblue]Long[/color]
Application.ScreenUpdating = [color=darkblue]False[/color]
[color=darkblue]Set[/color] wksSource = Worksheets("Sheet1")
[color=darkblue]With[/color] wksSource
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
[color=darkblue]If[/color] LastRow > 1 [color=darkblue]Then[/color]
.Range("C1:C" & LastRow).AdvancedFilter xlFilterInPlace, , , [color=darkblue]True[/color]
[color=darkblue]Set[/color] UniqueVals = .Range("C2:C" & LastRow).SpecialCells(xlCellTypeVisible)
[color=darkblue]Else[/color]
MsgBox "No data is available...", vbExclamation
[color=darkblue]GoTo[/color] ExitSub
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]For[/color] [color=darkblue]Each[/color] Cell [color=darkblue]In[/color] UniqueVals
Cnt = Cnt + 1
[color=darkblue]If[/color] [color=darkblue]Not[/color] Evaluate("ISREF('" & Cell.Value & "'!A1)") Then
[color=darkblue]Set[/color] wksDest = Worksheets.Add(before:=Worksheets(Cnt))
wksDest.Name = Cell.Value
[color=darkblue]Else[/color]
[color=darkblue]Set[/color] wksDest = Worksheets(Cell.Value)
wksDest.Cells.Clear
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]With[/color] wksSource
[color=darkblue]With[/color] .Range("A1:H" & LastRow)
.AutoFilter field:=3, Criteria1:=Cell.Value
.Copy Destination:=wksDest.Range("A1")
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]Next[/color] Cell
wksSource.AutoFilterMode = [color=darkblue]False[/color]
ExitSub:
Application.ScreenUpdating = [color=darkblue]True[/color]
[color=darkblue]If[/color] Cnt > 0 [color=darkblue]Then[/color]
MsgBox "Completed...", vbInformation
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]