I hope you can help me with the following.
I have a sheet in Excel, in which I need to make certain types of filters.
Criterion 1: Column A; It contains dates and I need to filter the most recent date. The date is in this form "Month and Day, example September 12".
I know how to set Autofilters with criteria in macro but with dates I could not filter the last date.
Example filter with criteria filtering the value 10 of column AG that is No 33:
Sheets("Nombre de la hoja").select
ActiveSheet.Range("$A:$AG").Autofilter Field:=33, Criteria:="">=10" , Operator:=xlAnd
Any ideas, just to filter the last date?
These are my data:
This is your code that I added to my Macro:
Sub FechaMax()
Dim FechaMax As Range
Sheets("CalcPromedios").Select
Sheets("CalcPromedios").Activate
With Application.WorksheetFunction
Set FechaMax = Range("A" & .Match(.Max(Range("A:A")), Range("A:A"), 0)) 'cambiar A por la columna que tiene las fechas
End With
ActiveSheet.Range("$A$1:$AG$65536").AutoFilter Field:=1, Criteria1:=FechaMax.Value 'cambiar el área de aplicación y el número de field
Set FechaMax = Nothing
End Sub
And I uploaded an example to my drive: link
DS