Hi, Guys,

This should be a pretty quick/simple question. I recorded the following macro that adds an autofilter, sets a criteria, and sorts. I would just like to generalize the code and make it dynamic, because the number of rows may sometimes increase.

Could someone show me the proper format?

Sub filtermacro()
'
' filtermacro Macro

    Range("A2:D2").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$2:$D$84").AutoFilter Field:=3, Criteria1:=">=30", _
        Operator:=xlAnd
    ActiveWorkbook.Worksheets("Nets").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Nets").AutoFilter.Sort.SortFields.Add Key:=Range( _
        "D2:D84"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Nets").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub