Professional Documents
Culture Documents
Les variables
Integer : Dim x As Integer
x=6
Range("A1").Value = x
// x = 5,5
// book = "excel"
24/02/2015
Dim i As Integer
For i = 1 To 10
Range("B1").Value = "Admis"
Next i
=================================
Else
For i = 1 To 20
End If
somme = somme + 5
Cells(1, i).Value = somme
Next i
3
24/02/2015
Dim i As Integer
For i = 1 To 6
i=1
Do While Cells(i, 1).Value <> "" And Cells(i, 2).Value <> ""
For j = 1 To 3
i=i+1
Next j
Loop
Next i
5
24/02/2015
La date
La date - DateAdd
Pour ajouter des jours, mois, minutes une date :
La date actuelle :
Range("A1").Value = Now
MsgBox Now // Hour(Now) Second, Minute, Day, Month, Year
Value
Explanation
yyyy
Year
Quarter // 3 mois
Month
Day
Weekday
ww
Week
Hour
Minute
Second
8
24/02/2015
Fermer le classeur
Ouvrir le classeur
End Sub
End Sub
10
24/02/2015
Application Object
Application.DisplayAlerts = False
Application.DisplayAlerts = True
Exemple 2 : Close
End Sub
ActiveWorkbook.Close
11
12
24/02/2015
ActiveX Controls
Userform
Mode cration >> Proprits >> Caption >> Gras & Bleu
TextBox
Deux OptionButtons
CheckBox
Selection.Font.Bold = True
CommandButton
Selection.Font.Color = vbBlue
End Sub
13
14
24/02/2015
Userform
Private Sub CommandButton1_Click()
Dim phrase As String
If TextBox1.Value <> "" Then phrase = "Nom : " & TextBox1.Value & vbNewLine
If OptionButton1.Value = True Then phrase = phrase & "Femme" & vbNewLine
If OptionButton2.Value = True Then phrase = phrase & "Homme" & vbNewLine
If CheckBox1.Value = True Then
phrase = phrase & "Etudiant interne" & vbNewLine
Else
phrase = phrase & "Etudiant externe" & vbNewLine
End If
MsgBox phrase
End Sub
15