Option Explicit
Dim n As Byte, Nb As Byte
Private Sub ComboBox1_Change()
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub UserForm_initialize()
Dim i As Byte
For i = 1 To 10
ComboBox1.AddItem i
Next i
'Alimentation en données de la combobox
ComboBox1.ListIndex = 0
'L'index 0 correspond à la première donnée contenue dans le ComboBox
For n = 2 To Sheets.Count
ListBox1.AddItem Sheets(n).Name
Next
Nb = ListBox1.ListCount - 1
End Sub
Private Sub Tout_Click()
For n = 0 To Nb
ListBox1.Selected(n) = True
Next
End Sub
Private Sub Rien_Click()
For n = 0 To Nb
ListBox1.Selected(n) = False
Next
End Sub
Private Sub OK_Click()
Dim Texte As String
For n = 0 To Nb
If ListBox1.Selected(n) = True Then
Me.Hide
'voir avant d'imprimer, avec : ShowModal=False !
'Sheets(ListBox1.List(n)).PrintPreview
Sheets(Array(ListBox1.List(n))).PrintOut Copies:=ComboBox1.Value, Collate:=True
Imprimer.Show
End If
Next
Unload Me
End Sub
Private Sub Annuler_Click()
Unload Me
End Sub