Hi all,
I have a file which is behaving quite strangely when filtering. I have attached a small copy. Basically I normally save dates as long, and then filter using the date serial. However on the attached something weird is going on - my vba doesn't seem to pick it up as a date or a long number. Also if you try manually filtering and typing in "01/06/2016" it shows nothing, yet if you go through the tick box and select June it works. Also if I set Jun as a string it seems to pick it up when I don't think it should be able to!
I have never come across this before, can anyone advise?
Code
Dim Ldte as long
DataLstRw = ThisWorkbook.Sheets("Data").UsedRange.Rows.Count
DataLstCl = ThisWorkbook.Sheets("Data").UsedRange.Columns.Count
LDte = DateSerial(Year(Date), Month(Date) - 1, 1)ThisWorkbook.Sheets("Data").Range(Cells(1, 1), Cells(DataLstRw, DataLstCl)).AutoFilter Field:=3, Criteria1:=LDte, Operator:=xlAnd