Cours Vba Excel
Cours Vba Excel
Do While continuer
ReDim Preserve tableau(taille)
saisie = InputBox("Entrez un élément (vide pour arrêter):")
If saisie = "" Then
continuer = False
Else
tableau(taille) = CInt(saisie)
taille = taille + 1
End If
Loop
For i = 0 To ListBox1.ListCount - 2
For j = i + 1 To ListBox1.ListCount - 1
If ListBox1.List(i) > ListBox1.List(j) Then
temp = ListBox1.List(i)
ListBox1.List(i) = ListBox1.List(j)
ListBox1.List(j) = temp
End If
Next j
Next i
End Sub
3. Afficher des cases à cocher toutes les X secondes
Dim NextTick As Double
Private Sub UserForm_Initialize()
NextTick = Timer + 5 ' Change toutes les 5 secondes
CheckBox1.Visible = True
CheckBox2.Visible = False
CheckBox3.Visible = False
End Sub
Sub ToggleCheckboxes()
If Timer >= NextTick Then
CheckBox1.Visible = Not CheckBox1.Visible
CheckBox2.Visible = Not CheckBox2.Visible
CheckBox3.Visible = Not CheckBox3.Visible
NextTick = Timer + 5
End If
Application.OnTime Now + TimeValue("00:00:01"), "ToggleCheckboxes"
End Sub
4. Changer l'image d'un bouton
Dim CurrentImage As Integer