
Originally Posted by
jxm1092
and the data on each individual worksheet can be put in order by time that would be great. Also were would be a great place to get some insight on how to write these types of macros myself?
Thanks eveyrone.
Sub test()
Dim x, e
Application.ScreenUpdating = False
With Sheets("R1_1375_test").Cells(1).CurrentRegion
.Sort key1:=.Cells(1, 3), order1:=1, key2:=.Cells(1, 2), order2:=1, Header:=xlYes
With .Offset(1).Resize(.Rows.Count - 1).Columns("c")
x = Filter(.Parent.Evaluate("transpose(if(countif(offset(" & _
.Address & ",0,0,row(1:" & .Rows.Count & "))," & .Address & _
")=1," & .Address & ",char(2)))"), Chr(2), False)
End With
For Each e In x
If Not IsSheetExists(e) Then Sheets.Add(after:=Sheets(Sheets.Count)).Name = e
Sheets(e).Cells.Clear
.AutoFilter 3, e
.Copy Sheets(e).Cells(1)
With Sheets(e).Cells(1).CurrentRegion
.Sort .Cells(1, 2), 1, Header:=xlYes
.Columns.AutoFit
End With
.AutoFilter
Next
.Sort .Cells(1), 1, Header:=xlYes
.Parent.Activate
End With
Application.ScreenUpdating = True
End Sub
Function IsSheetExists(ByVal txt As String) As Boolean
On Error Resume Next
IsSheetExists = Len(Sheets(txt).Name)
On Error GoTo 0
End Function
Bookmarks