1 pièce(s) jointe(s)
Formulaire VBA problème avec cellules contenant des dates
Bonjour,
je rencontre un problème avec ce formulaire en vba au niveau d'une cellule contenant une date, à chaque modification via la macro, je me retrouve avec la date au format anglais ou français, une date yoyo...
Je ne sais pas comment utiliser un CDate ou Format, si quelqu'un a quelques secondes à m'accorder ce serais fort sympatique, merci ^^
Code:
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
| Private Sub UserForm_Initialize()
With Sheets("Gestion")
dl = .Cells(Application.Rows.Count, 1).End(xlUp).Row
Set pl = .Range("A2:A" & dl)
End With
Me.ctrl1.List = pl.Value
End Sub
Private Sub ctrl1_Change()
Dim i As Byte
Dim lg As Integer
If Me.ctrl1.ListIndex <> -1 Then
lg = ctrl1.ListIndex + 2
For i = 1 To 21
Me.Controls("ctrl" & i).Value = Sheets("Gestion").Cells(lg, Me.Controls("ctrl" & i).Tag)
Next i
End If
End Sub
Private Sub Btn_OK_Click()
Dim r As Range
Dim li As Integer
Dim i As Integer
Set r = pl.Find(ctrl1.Value, , xlFormulas, xlWhole)
If r Is Nothing Then
li = dl + 1
Else
li = r.Row
If MsgBox(" Vous confirmez la modification ?", vbOKCancel + vbQuestion, "MODIFICATION DEMANDE EXISTANTE") = vbCancel Then Exit Sub
End If
For i = 1 To 21
Sheets("Gestion").Range(Me.Controls("Ctrl" & i).Tag & li).Value = Me.Controls("Ctrl" & i).Value
Next i
Unload Me
End Sub |
Ci joint le classeur avec le code