Hello
The user made a last request, and could you please help me? When the user types the "Date From" and "Date to", the "/" starts appearing as long as the user types I am trying via the code below
The user made a last request, and could you please help me? When the user types the "Date From" and "Date to", the "/" starts appearing as long as the user types I am trying via the code below
VBA Code:
Sub TableFilt1()
Dim ToDate As Date, FrDate As Date
With Sheet6
LastRow = .Range("E99999").End(xlUp).Row
If .Range("M5").Value > .Range("N5").Value Then
MsgBox "Invalid Date Range.""Date to"" must be greater than ""Date from"""
Call ClearFilt
.Range("A1").Select
Exit Sub
End If
If .Range("M5").Value = "From Date" Then FrDate = "01/05/2018" Else: FrDate = .Range("M5").Value
If .Range("N5").Value = "To Date" Then ToDate = "01/04/2021" Else: ToDate = .Range("N5").Value
With .Range("E6:AU" & LastRow)
.AutoFilter Field:=9, _
Criteria1:=">=" & Left(FrDate, 2), & "/" & Mid(FrDate, 3, 2) & "/" & Right(FrDate, 2), _
Operator:=xlAnd, _
Criteria2:="<=" & Left(ToDate, 2), & "/" & Mid(ToDate, 3, 2) & "/" & Right(ToDate, 2)
End With
End With
End Sub