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
| Option Explicit
Private Sub CommandButton1_Click()
Dim i As Long, shX As Object
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Set shX = ActiveWorkbook.Sheets(ListBox1.List(i))
If shX.Visible = False Then
shX.Visible = xlSheetVisible
shX.PrintOut
shX.Visible = xlSheetHidden
Else
shX.PrintOut preview:=True
End If
End If
Next i
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To Sheets.Count
ListBox1.AddItem
ListBox1.List(i - 1, 0) = Sheets(i).Name
ListBox1.List(i - 1, 1) = IIf(Sheets(i).Visible = -1, "Visible", "Masqué")
Next i
End Sub |
Partager