Hi,
I was able to find VBA code that would sort my data the way I wanted. Typically the WO#s are 5 digit numbers, which works great. Unfortunately it only works with numbers, and occasionally I have a letter suffix on some of my warehouse orders that seems to be causing problems. Anyway to make this work? I have included the code and a screen shot of the worksheet. Let me know if I missed anything?
I was able to find VBA code that would sort my data the way I wanted. Typically the WO#s are 5 digit numbers, which works great. Unfortunately it only works with numbers, and occasionally I have a letter suffix on some of my warehouse orders that seems to be causing problems. Anyway to make this work? I have included the code and a screen shot of the worksheet. Let me know if I missed anything?
VBA Code:
Sub SingleLevelSort()
Dim SelectR As Range
Dim sht As Worksheet
Dim LastRow As Long
Worksheets("Master").Unprotect "password"
On Error GoTo ErrorHandler
Set sht = ThisWorkbook.Sheets("Master")
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
Set SelectR = ThisWorkbook.Sheets("Master").Range("A5:A150")
SelectR.TextToColumns Destination:=Range("A5"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Dim rng As Range, cell As Range
Set rng = Range("A5:A150")
For Each cell In rng
Debug.Print Round(cell.Value, 0)
Next cell
Worksheets("Master").Sort.SortFields.Clear
Range("A4:F150").Sort Key1:=Range("A4"), Header:=xlYes
Worksheets("Master").Protect "password"
Exit Sub
ErrorHandler:
MsgBox "No Data To Sort, Please add Orders"
Worksheets("Master").Protect "password"
Exit Sub
End Sub