Hi, I am trying to find the max value of a filtered column of numbers. The code below will not search with in the filtered results but with in the entire column. Can anyone tell me what I need to change or what I should do to get the correct results?
Thanks in advance.


Columns("G:G").Select
Selection.AutoFilter Field:=3, Criteria1:=lastname
Range("G2:G2000" & lastRow).Select
Selection.SpecialCells(xlCellTypeVisible).Select



MsgBox Selection.SpecialCells(xlCellTypeVisible).Application.WorksheetFunction.Max(Range("G2:G2000"))