Types de variables en VBA
Les variables vues dans cette vidéo sont: Integer, Long, LongLong, LongPtr, Currency, Decimal, Single, Double, Objet, Date, Type défini par l'utilisateur et Collection Code source Option Explicit Const pi As Single = 3.1415926 Sub test_integer() Dim i 'For i = 0 To 100000 Step 10000 ' Debug.Print i 'Next Debug.Print VarType(i) i = 0 Debug.Print VarType(i) i = "0" Debug.Print VarType(i) End Sub Sub test_decimal() Dim d As Variant d = CDec(100 / 3) Debug.Print d d = CDec("1,12345678") Debug.Print d End Sub Sub test_objet() Dim Feuille As Object Dim Nom As String * 50 Set Feuille = Worksheets(1) Nom = "Nom fichier """ & Feuille.Name & """" Debug.Print Nom Nom = "Nom fichier " & Chr(34) & Feuille.Name & Chr(34) Debug.Print Nom End Sub Sub test_date() Dim d1 As Date, d2 As Date d1 = 1.86 Debug.Print d1 Debug.Print Format(d1 + 1, "m/dd/yyyy") Debug.Print Format(d1 + 1, ...