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 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Sub Typename_Date_vers_Numberformats()
Columns("A:D").Clear
Dim s As Date
s = CDate("10-01-2000")
Cells(1, 1) = "Valeur attendue"
Cells(1, 2) = CDate(s)
Cells(1, 3) = CDate(s)
Cells(1, 4) = CDbl(CDate(s))
col = 1
lig = 5
Cells(lig, "B").NumberFormat = "@"
Cells(lig, "C").NumberFormat = "General"
Cells(lig, "D").NumberFormat = "0"
Cells(lig - 1, "B").Value = "'" & Cells(lig, "B").NumberFormat
Cells(lig - 1, "C").Value = "'" & Cells(lig, "C").NumberFormat
Cells(lig - 1, "D").Value = "'" & Cells(lig, "D").NumberFormat
Cells(lig - 1, "A").Value = TypeName(s) & " -->"
Cells(lig, "A").Value = "Valeur obtenue"
Cells(lig, "B").Value = s
Cells(lig, "C").Value = s
Cells(lig, "D").Value = s
Call Typename_String_vers_Numberformats
Cells(lig - 2, "B").Value = "Proprietes NumberFormat"
End Sub
Sub Typename_String_vers_Numberformats()
Dim s As String
s = "10-01-2000"
Cells(1, 2) = CDate(s)
Cells(1, 3) = CDate(s)
Cells(1, 4) = CDbl(CDate(s))
col = 1
lig = 8
Cells(lig, "B").NumberFormat = "@"
Cells(lig, "C").NumberFormat = "General"
Cells(lig, "D").NumberFormat = "0"
Cells(lig - 1, "B").Value = "'" & Cells(lig, "B").NumberFormat
Cells(lig - 1, "C").Value = "'" & Cells(lig, "C").NumberFormat
Cells(lig - 1, "D").Value = "'" & Cells(lig, "D").NumberFormat
Cells(lig - 1, "A").Value = TypeName(s) & " -->"
Cells(lig, "A").Value = "Valeur obtenue"
Cells(lig, "B").Value = s
Cells(lig, "C").Value = s
Cells(lig, "D").Value = s
End Sub |