Wow, Thanks PLC... I have never seen the .AutoFilter before. I had no idea what it was or how to use it. Unfortunately, It didn't do the trick. And I had some fun cleaning up the mess. hehehe...
Trouble is, I only want information the rows within the dynamic Range "Dock" to be sorted.
Worksheet is layed out similarly to:
Data I don't want to touch.....
Data I don't want to touch.....
Data I don't want to touch.....
Range("Dock") = TM03010040 Other Data Other Data
Range("Dock") = TM08030020 Other Data Other Data
Range("Dock") = TM98010040 Other Data Other Data
Data I don't want to touch.....
Data I don't want to touch.....
Data I don't want to touch.....
I want to sort ONLY the rows used by Range("Dock")
And I am trying to sort by the value of the range... which would be the TM#
TM#'s are designed by "call" "YYMM" "ref#"
where "call" is a 2 letter call name like TM or CR
"YYMM" Is the year and month
"ref#" Is a 4 digit number
TMYYMM####
Code:
Sub DocketSort(SheetName As String)
Dim Cel As Range
Application.ScreenUpdating = False
Range("B:C").Insert
For Each Cel In ThisWorkbook.Worksheets(SheetName).Range("Docket")
If Left(Cel.Value, 2) Like "TM" Then
Cel.Offset(0, 11).Value = "=DATE(IF(MID(A" & Cel.row & ",3,1) = ""9"", MID(A" & Cel.row _
& ",3,2),20 & MID(A" & Cel.row & ",3,2)),(MID(A" & Cel.row & ",5,2)),1)"
Cel.Offset(0, 12).Value = "=MID(A" & Cel.row & ",7,4)"
End If
Next
'Need Selection.sort on Column B as a date then Column C as Number
'BUT!!! This Needs to ONLY sort the information within the rows referenced by Range("Dock")
Range("B:C").Delete
Application.ScreenUpdating = True
End Sub
This code gives me 2 columns. The first, B, has dates only on rows referenced by "Dock" And the second column, C, has the ref# on the same rows
Is there a way to sort ONLY the rows that are part of my range "Dock"?
Dock is a DYNAMIC range... so it will change in size.
So hard coding specific rows will not work.
Also, could I sort based on Dates?
And can I sort based on 2 columns?
Any other suggestions? Please help... Any Ideas seem to get me a little closer...