Faintkitara
Board Regular
- Joined
- Jun 23, 2016
- Messages
- 59
Hello,
I am having trouble adding the sort function into code that autofilters based off of criteria. I would like for this code to sort Greatest to Least based off of a specific column name ("Prior" or P in the code).
I am also not sure if I should apply the filter criteria and then sort or vice versa.
Here is what I have. What should I add?
I am having trouble adding the sort function into code that autofilters based off of criteria. I would like for this code to sort Greatest to Least based off of a specific column name ("Prior" or P in the code).
I am also not sure if I should apply the filter criteria and then sort or vice versa.
Here is what I have. What should I add?
Code:
Set Heading = Worksheets("Backlog").Range("A4")a = Application.WorksheetFunction.Match(P, Range("A4:JD4"), 0)
Worksheets("log").Range("A4:EX4").AutoFilter
Heading.AutoFilter Field:=a, Criteria1:=">2499"
Const Row As Integer = 4
LC = Cells(Row, Columns.Count).End(xlToLeft).Column
For H = LC To 1 Step -1
If (Cells(Row, H) = C) Then
customercolumn = H
End If
Next
lrq = Cells(Rows.Count, customercolumn).End(3).Row
Worksheets("log").Range(Cells(Row, customercolumn), Cells(lrq, customercolumn + 1)).Copy _
Destination:=Worksheets("Pivot").Range("N4:O10000")