Hi swordswinger710
This Code in the attached appears to do as you require for the Custom Sort Routine...let me know of issues...
Option Explicit
Sub Copy_Me()
Dim rng As Range
Dim ws As Worksheet, ws1 As Worksheet
Set ws = Sheets("Current Thread Gauge List")
Application.ScreenUpdating = False
With ws
.Cells.EntireColumn.Hidden = False
.UsedRange.Offset(2, 0).Clear
End With
Set ws1 = Sheets("Current List")
Application.ScreenUpdating = False
With ws1
Set rng = .Range("A3:T" & .Range("A3").End(xlDown).Row)
rng.AutoFilter Field:=3, Criteria1:="=Thread Gauge", _
Operator:=xlAnd
rng.Copy
End With
With ws
.Range("A3").PasteSpecial
.Columns.AutoFit
.Columns("C:J").EntireColumn.Hidden = True
.Columns("L:L").EntireColumn.Hidden = True
.Columns("N:T").EntireColumn.Hidden = True
' Set rng = .Range("A3:T" & .Range("A3").End(xlDown).Row)
Call Sort_Me
.Range("A1").Select
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
ws1.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
Sub Sort_Me()
Dim ws As Worksheet
Dim rng As Range, cel As Range
Dim iCustListNum As Long
Set ws = Sheets("Current Thread Gauge List")
With ws
.Columns("AC:AF").Delete
.Columns("AC:AE").NumberFormat = "@"
.Columns("AF:AF").NumberFormat = "General"
Set rng = .Range("B4:B" & .Range("A3").End(xlDown))
rng.Copy Destination:=.Range("AC4")
Set rng = .Range("AC4:AC" & .Range("A3").End(xlDown))
For Each cel In rng
On Error Resume Next
cel.Offset(0, 1).Value = Split(cel, "-")(0)
cel.Offset(0, 2).Value = Split(cel, "-")(1)
cel.Offset(0, 3).FormulaR1C1 = "=CONCATENATE(RC[-2],""-"",RC[-1])"
On Error GoTo 0
Next cel
.Sort.SortFields.Clear
.Sort.SortFields.Add Key _
:=Range("AD4:AD" & .Range("A3").End(xlDown)), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortTextAsNumbers
With ws.Sort
.SetRange Range("AD4:AE" & Range("A3").End(xlDown))
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Set rng = .Range("AF4:AF" & .Range("A3").End(xlDown))
iCustListNum = Application.CustomListCount + 1
Application.AddCustomList rng.Value
.Sort.SortFields.Clear
.Sort.SortFields.Add Key _
:=Range("B3:B" & .Range("A3").End(xlDown)), CustomOrder:= _
Application.CustomListCount, DataOption:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Current Thread Gauge List").Sort
.SetRange Range("A3:M" & Range("A3").End(xlDown))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.DeleteCustomList Application.CustomListCount
.Columns("AC:AF").Delete
End With
End Sub
Bookmarks