1 2 3 4 5 6 7 8 9 10 11 12
| Function Traitement_Date(ByVal Ligne As Integer, ByVal Colonne As Integer) As Boolean
Dim celldate As Range: Set celldate = ThisWorkbook.Worksheets("coller").Cells(Ligne, Colonne)
With celldate
If Len(.Text) <> 4 Then: MsgBox "Longeur de la cellule doit être de 4 caractères": .Select: Exit Function:
If Not IsNumeric(.Value) Then: MsgBox "La date doit être au format numérique": .Select: Exit Function:
.Offset(1, 0) = Mid$(.Value, 1, 2) & "/" & Mid$(.Value, 3, 2) & "/" & Year(Now)
If Not IsDate(.Offset(1, 0)) Then MsgBox "Date au format mmdd attendu": .Select: Exit Function:
End With
Traitement_Date = True
End Function |