1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Function TrouveType(V)
TrouveType = V
If IsDate(TrouveType) = True And InStr(TrouveType, "/") <> 0 And InStr(TrouveType, ":") <> 0 Then TrouveType = Format(TrouveType, "yyyy-mm-dd hh:mm"): Exit Function
If IsDate(TrouveType) = True And InStr(TrouveType, "/") <> 0 Then TrouveType = Format(TrouveType, "yyyy-mm-dd"): Exit Function
If IsNumeric(Replace(TrouveType, ".", ",")) = True Then TrouveType = Replace(TrouveType, ",", "."): Exit Function
End Function
Private Sub CommandButton1_Click()
Dim dateDeb As Date, datFin As Date
dateDeb = TrouveType(TextBox1)
datFin = TrouveType(TextBox2)
Feuil2.ListObjects("Tableau1").Range.AutoFilter Field:=1, Criteria1:= _
">=" & dateDeb, Operator:=xlAnd, Criteria2:="<=" & datFin
Unload Me
End Sub |
Partager