View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
will will is offline
external usenet poster
 
Posts: 11
Default Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook

No luck with this working. The problem is that arr(N) is not getting
the actual name of the worksheet it is just putting in "Sheet1"
"Sheet2" "Sheet3" etc...
Whereas the names of my sheets are "Data" "XYZ" "YTD" etc...

Thoughts?

"Ron de Bruin" wrote in message ...
Hi Will

Try this

Sub Print_Visible_sheets()
'xlSheetVisible = -1
Dim sh
Dim arr() As String
Dim N As Integer
N = 0
For Each sh In ThisWorkbook.Sheets
If sh.Visible = -1 Then
N = N + 1
ReDim Preserve arr(1 To N)
arr(N) = sh.Name
End If
Next
ThisWorkbook.Sheets(arr).PrintOut
Sheets(1).Select
End Sub


More info here
http://www.rondebruin.nl/print.htm#visible




--
Regards Ron de Bruin
http://www.rondebruin.nl


"will" wrote in message om...
I thought that this would do it but it is giving me an error of:
1004 Methough PrintOut of object Sheets failed

Sub PrintMacro()
vCopies = InputBox("How Many Copies?")
i = 1
For i = 1 To vCopies
Sheets.PrintOut
Next i
End Sub

Any help is appreciated
Thanks