View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
MarcoR
 
Posts: n/a
Default Printing hidden worksheets

Dave,

It worked.
Thank you so much.

Marco

"Dave Peterson" wrote:

The macro recorder is very useful for stuff like this.

I recorded a macro (and did some minor tweaking (really unnecessary, though) and
got something that looked like:

Option Explicit
Sub Macro1()
Sheets("Sheet8").Visible = xlSheetVisible
Sheets("Sheet7").Visible = xlSheetVisible
Sheets("Sheet6").Visible = xlSheetVisible
Sheets("Sheet5").Visible = xlSheetVisible
Sheets("Sheet4").Visible = xlSheetVisible

Sheets(Array("Sheet8", "Sheet7", "Sheet6", "Sheet5", "Sheet4")) _
.PrintOut preview:=True

Sheets("Sheet8").Visible = xlSheetHidden
Sheets("Sheet7").Visible = xlSheetHidden
Sheets("Sheet6").Visible = xlSheetHidden
Sheets("Sheet5").Visible = xlSheetHidden
Sheets("Sheet4").Visible = xlSheetHidden
End Sub

Remember to use the sheet names you want.

MarcoR wrote:

Thank you Dave.

As I am a complete beginner, I do not know how to add code to unhide sheets.
Would it be possible for you to give me detailed procedure?

"Dave Peterson" wrote:

Add code to unhide sheets 2-5, print your worksheets and rehide sheets 2-5.





MarcoR wrote:

Hi.

I have a worksheet (Worksheet1)with a command button to print out 4 other
worksheets.
I used Sheets(Array("Sheet2","Sheet3","Sheet4","Sheet5")) .PrintOut
This is working fine.
Now, I want to hide the Sheets2-5 and be able to use the command button to
print them all out.
How is this done?

--

Dave Peterson


--

Dave Peterson