I'm attempting to filter one of the columns where the hour needs to be greater than 7 am and smaller than 19 pm, and the date needs to be today's date or a specified date.
This is how my data set looks: 2023/03/17 16:00
I am trying to use the following code:
Sub FilterInicioDeTurnoDAY()
Dim in_time As Double, out_time As Double, dtToday As Date
dtToday = Date
in_time = dtToday + TimeValue("07:00")
out_time = dtToday + TimeValue("18:59")
Sheets("PegarCitas_INICIOdeTURNO").Select
ActiveSheet.Range("E:E").AutoFilter Field:=34, Operator:=xlAnd, Criteria1:=">=" & in_time, Criteria2:="<=" & out_time
End Sub
However, running the macro does not filter the values I need. What am I doing wrong?