I am currently using the following macro assigned to a command button to sort a list of jobs by the due date. I have others that sort by Customer and Job #. It works great for what it was originally written for. Sometimes(more now due to Covid) we have jobs that sit in the shop past their due dates and would like to list them at the bottom when sorted and not the top like they do with the current way it sorts so we are looking at current jobs first.
Sub Due_Date()
'
' Due_Date Macro
'
'
Range("A4:W75").Select
ActiveWorkbook.Worksheets("Job Board").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Job Board").Sort.SortFields.Add2 Key:=Range( _
"F5:F75"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Job Board").Sort
.SetRange Range("A4:W75")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A5").Select
End Sub
I was thinking it would be something like "If F is < O2 (Cell which displays the current date) then move that to the bottom of the list. " the exact format is where I fall flat.
I appreciate any help with this.
Sub Due_Date()
'
' Due_Date Macro
'
'
Range("A4:W75").Select
ActiveWorkbook.Worksheets("Job Board").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Job Board").Sort.SortFields.Add2 Key:=Range( _
"F5:F75"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Job Board").Sort
.SetRange Range("A4:W75")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A5").Select
End Sub
I was thinking it would be something like "If F is < O2 (Cell which displays the current date) then move that to the bottom of the list. " the exact format is where I fall flat.
I appreciate any help with this.