I am using the following code to filter and sort a data set. There is a field column H or field 8. In that field there can be values of 0, 1 ,2 which is a priority field.
How can this code be edited to include saying, give me all the priorities 0, 1, and 2 no matter the date in column T which is sorted by. Would like the zero's ones and twos all at the top of the page no matter the date in column T, then put the rest of the date in that is < today.
Issue is that I need get all the priorities that are in first no matter the date in column T, and then try and sort column T, leaving the 0's 1's and 2's are at the top, and Everything else in the filter or sort would apply after the priorities are in place.
Can this even be done?
I am thinking that I may need to filter twice.... One that gives me all the priorties no matter the date in column T, then copy that over to a new sheet, then run the other filter/sort and append that to the first set, then count how many are in that and put that total in the distination field.
Need some guidance and help with these edits. -R-
Dim rgFilter As Range, rgTarg As Range
Set rgTarg = Worksheets("DS - Summary").Range("F8") 'Record count goes here
With Worksheets("Format") 'Worksheet to be filtered
Set rgFilter = .Range("A1") 'First header label in range to be filtered
Set rgFilter = Intersect(.UsedRange, rgFilter.Resize(1, 100).EntireColumn) 'All the rows of data
.AutoFilter Field:=9, Criteria1:="=*ADD*" _
.AutoFilter Field:=10, Criteria1:=Array( _
"CRTD", "PCNF REL", "REL"), Operator:=xlFilterValues
.AutoFilter Field:=20, Criteria1:="<=" & Date, Operator:=xlAnd 'Late including today
.Sort Key1:=Range("T1"), Order1:=xlAscending, Header:=xlGuess, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin
' Column 31, filter out any row that has REJ as contents in a cell.
.AutoFilter Field:=31, Criteria1:="<>*REJ*", Operator:=xlAnd
' If you want to dsiplay the cells that CONTAIN "REJ", Use => Criteria1:="=*REJ*"
' If you want to dsiplay the cells that DO NOT CONTAIN "REJ", Use => Criteria1:="<>*REJ*"