ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print a Single Hidden Worksheet? (https://www.excelbanter.com/excel-programming/421654-print-single-hidden-worksheet.html)

SSDSCA

Print a Single Hidden Worksheet?
 
I have a dynamic workbook with two hidden sheets named "Lists" and "Day
Cost". The only way I can, at present, print out the "Day Cost" sheet is to
leave it unhidden, however I would prefer to have it hidden as it has
formulas that pull the information from the other visible sheets. Can
somebody help me with a macro that would allow me to have both the "Day Cost"
and "Lists" sheet remain hidden and only print "Day Cost" out.
--
Thanks and Regards,
Don

JLGWhiz

Print a Single Hidden Worksheet?
 
I believe the sheet has to be visible but you can use a sequence like the one
below to print the sheet and it is only visible for an instant.

Sub prtSeq()
Sheets("Day Cost").Visible = True
Sheets("Day Cost").PrintOut
Sheets("Day Cost").Visible = False
End Sub



"SSDSCA" wrote:

I have a dynamic workbook with two hidden sheets named "Lists" and "Day
Cost". The only way I can, at present, print out the "Day Cost" sheet is to
leave it unhidden, however I would prefer to have it hidden as it has
formulas that pull the information from the other visible sheets. Can
somebody help me with a macro that would allow me to have both the "Day Cost"
and "Lists" sheet remain hidden and only print "Day Cost" out.
--
Thanks and Regards,
Don


Gary Keramidas

Print a Single Hidden Worksheet?
 
you can give this a try, just change the print parameters

Option Explicit
Sub printHidden()
Dim ws2 As Worksheet
Dim lastrow As Long
Application.ScreenUpdating = False
Set ws2 = Worksheets("Lists")
lastrow = ws2.Cells(Rows.Count, "A").End(xlUp).Row


With ws2.PageSetup
.PrintTitleRows = "$1:$1"
.Orientation = xlPortrait
.PrintGridlines = True
.Zoom = 90
.RightMargin = Application.InchesToPoints(0.4)
.LeftMargin = Application.InchesToPoints(0.4)
.TopMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.5)
.RightFooter = "Page " & "&P" & " of " & "&N"
.RightHeader = "&B&12 " & Date
.PrintArea = "A2:M" & lastrow
.CenterFooter = ""
.FooterMargin = Application.InchesToPoints(0.3)
End With

If ws2.Visible = 0 Then
ws2.Visible = -1
ws2.PrintPreview
ws2.Visible = 0
End If
Application.ScreenUpdating = True
End Sub



--


Gary

"SSDSCA" wrote in message
...
I have a dynamic workbook with two hidden sheets named "Lists" and "Day
Cost". The only way I can, at present, print out the "Day Cost" sheet is to
leave it unhidden, however I would prefer to have it hidden as it has
formulas that pull the information from the other visible sheets. Can
somebody help me with a macro that would allow me to have both the "Day Cost"
and "Lists" sheet remain hidden and only print "Day Cost" out.
--
Thanks and Regards,
Don




Per Jessen

Print a Single Hidden Worksheet?
 
Hi Don

Try this:

Sub PrintHiddenSheets()
Application.ScreenUpdating = False
With Sheets("Lists")
.Visible = True
.PrintOut
.Visible = False
End With
With Sheets("Day Cost")
.Visible = True
.PrintOut
.Visible = False
End With
Application.ScreenUpdating = True
End Sub

Regards,
Per

"SSDSCA" skrev i meddelelsen
...
I have a dynamic workbook with two hidden sheets named "Lists" and "Day
Cost". The only way I can, at present, print out the "Day Cost" sheet is
to
leave it unhidden, however I would prefer to have it hidden as it has
formulas that pull the information from the other visible sheets. Can
somebody help me with a macro that would allow me to have both the "Day
Cost"
and "Lists" sheet remain hidden and only print "Day Cost" out.
--
Thanks and Regards,
Don



SSDSCA

Print a Single Hidden Worksheet?
 
Thanks guys. you can't imagine how much I have learned from not only your
responses but by all the responses that are posted. You are appreciated.
--
Thanks and Regards,
Don


"SSDSCA" wrote:

I have a dynamic workbook with two hidden sheets named "Lists" and "Day
Cost". The only way I can, at present, print out the "Day Cost" sheet is to
leave it unhidden, however I would prefer to have it hidden as it has
formulas that pull the information from the other visible sheets. Can
somebody help me with a macro that would allow me to have both the "Day Cost"
and "Lists" sheet remain hidden and only print "Day Cost" out.
--
Thanks and Regards,
Don



All times are GMT +1. The time now is 11:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com