- Joined
- Feb 9, 2009
- Messages
- 1
- Reaction score
- 0
I am trying to search for the max value in a filtered column. But for some reason it returns the max value for the entire column. Can anyone tell me what I am doing wrong? Thanks in advance
Code:
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"))