Hi,
have listbox listing all sheets and the code below to print them the problem is all sheets are hidden, how to get the to unhide print once print done to hide it again,
here is the code:
here the listbox code:
thank you,
have listbox listing all sheets and the code below to print them the problem is all sheets are hidden, how to get the to unhide print once print done to hide it again,
here is the code:
VBA Code:
Sub Print_Sheets()
Dim i As Long, c As Long
Dim SheetArray() As String
With ActiveSheet.ListBoxSh
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve SheetArray(c)
SheetArray(c) = .List(i)
c = c + 1
End If
Next i
Sheets(SheetArray()).PrintPreview
'If you'd like to print out
'Sheets(SheetArray()).PrintOut
End With
End Sub
here the listbox code:
VBA Code:
Private Sub Worksheet_Activate()
Dim Sh
Me.ListBoxSh.Clear
For Each Sh In ThisWorkbook.Sheets
Me.ListBoxSh.AddItem Sh.Name
Next Sh
End Sub
thank you,