I am having difficulty figuring out how to sort with a variable. I have a macro that used a given cell value as a variable. I have named this variable "a". I have checked to make sure the variable is set to the value I want from the cell selected. I want to now use this variable as a sorting criteria. Here is the code I used to try and do this.
ActiveSheet.Range("$A$1:$T$" & r).AutoFilter Field:=5, Criteria1:= _ "<" & a, Operator:=xlAnd