1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Sub Essai2()
Dim maCellule As Range, tblDate
With ThisWorkbook.Worksheets(1).Range("B12").CurrentRegion
For Each maCellule In .Cells
If IsDate(maCellule.Value) Then
tblDate = Split(maCellule.Value, "/")
If tblDate(0) <= 12 Then
'date mm/dd/yyyy ==> jj/mm/aaaa
maCellule.Value = DateSerial(tblDate(2), tblDate(0), tblDate(1))
Else
'on force les valeurs 'jj/mm/aaaa' dont jj > 12 au format date
maCellule.Value = DateSerial(tblDate(2), tblDate(1), tblDate(0))
End If
End If
Next
End With
End Sub |