1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Private Sub CommandButton1_Click()
Dim Ctrl As Control
Dim r As Integer
Dim t As Integer
Dim derligne As Integer
With Worksheets("Feuil2")
derligne = .Range("A65536").End(xlUp).Row + 1
For Each Ctrl In UserForm2.Controls
r = Val(Ctrl.Tag)
If r > 0 Then Feuil2.Cells(derligne, r) = TrouveType(Ctrl)
Next
ComboBox1 = ""
TextBox1 = ""
End With
Unload Me
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub UserForm_Initialize()
'spécifie la date du jour lors de l'affichage de l'USF
DTPicker1.Value = Now
End Sub
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 TextBox1_Change()
'Kilométrage
'autorise la validation si valeur dans Textbox est numérique
CommandButton1.Enabled = IsNumeric(TextBox1.Value)
End Sub |
Partager