Hi guys,
Been stuck on this for days now so I'm resorting to asking for assistance on this one.
I'm trying to filter between two dates in dd/mm/yyyy format ( my PC is formatted this way too in regional settings), but after I run the code, the date "custom filter" has mixed up the days and months.
Here is my code, where c3 is the start date, formatted dd/mm/yyyy, and c4 is end date, formatted dd/mm/yyyy, Sheet10.Range("a4") is the table of data, and column 34 is the column I need to apply the date filter to.
Dim DateBegin As Date
Dim DateEnd As Date
Dim Rng As Range
Set Rng = Sheet10.Range("a4")
DateBegin = Format(Sheet1.Range("c3").Value, "dd/mm/yyyy")
DateEnd = Format(Sheet1.Range("c4").Value, "dd/mm/yyyy")
With Rng
.AutoFilter Field:=34, Criteria1:=">" & DateBegin, _
Operator:=xlAnd, Criteria2:="<=" & DateEnd
What am I doing wrong here? Would be so grateful if somebody could help me out on this one,
Been stuck on this for days now so I'm resorting to asking for assistance on this one.
I'm trying to filter between two dates in dd/mm/yyyy format ( my PC is formatted this way too in regional settings), but after I run the code, the date "custom filter" has mixed up the days and months.
Here is my code, where c3 is the start date, formatted dd/mm/yyyy, and c4 is end date, formatted dd/mm/yyyy, Sheet10.Range("a4") is the table of data, and column 34 is the column I need to apply the date filter to.
Dim DateBegin As Date
Dim DateEnd As Date
Dim Rng As Range
Set Rng = Sheet10.Range("a4")
DateBegin = Format(Sheet1.Range("c3").Value, "dd/mm/yyyy")
DateEnd = Format(Sheet1.Range("c4").Value, "dd/mm/yyyy")
With Rng
.AutoFilter Field:=34, Criteria1:=">" & DateBegin, _
Operator:=xlAnd, Criteria2:="<=" & DateEnd
What am I doing wrong here? Would be so grateful if somebody could help me out on this one,