Posted to microsoft.public.excel.programming
|
|
Printing multiple worksheets only if data exists
Much appreciated Tom,
JMay
"Tom Ogilvy" wrote in message
...
There was a typo on my part
Sub PrintOnlyCertainSheets()
Dim Sh as Worksheet
For Each Sh In ActiveWorkbook.worksheets
If Not IsEmpty(Sh.Range("B5")) Then
Sh.PrintPreview
End If
Next
End Sub
there is no reason to group sheets unless you want to work with a subset
of
all worksheets
Dim sh as Object
for each sh in ActiveWindow.SelectedSheets
--
Regards,
Tom Ogilvy
JMay wrote in message
news:0WtAb.47637$yM6.32904@lakeread06...
From you suggestion I've create a WB with Sheet1-Sheet3
And in only Sheet1 Cell B5 I have entered "444".
Grouping All Sheets before running the below I Get an error:
"Circular Dependencies between Modules"
with For Each Sh In ActiveWorkbook highlighted
Sub PrintOnlyCertainSheets()
For Each Sh In ActiveWorkbook
If Not IsEmpty(Sh.Range("B5")) Then
Sh.PrintPreview
End If
Next
End Sub
What have I done wrong?
TIA,,
JMay
"Tom Ogilvy" wrote in message
...
for each sh in activeworkbook
if not isempty(sh.Range("B30")) then
sh.printout
end if
Next
--
regards,
Tom Ogilvy
hailnorm wrote in message
...
I need a print macro that only prints worksheets with data on it.
Basically, I need excel to print each and every worksheet where
there's
a "grand total" value. This value is located in the same cell on
every
worksheet.
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from
http://www.ExcelForum.com/
~~Now Available: Financial Statements.xls, a step by step guide to
creating financial statements
|