Try this modification of Mike's suggestion:
Sub PrintCondition()
Dim w As Worksheet
For Each w In Worksheets
If w.Range("A9").Value 10 And _
w.Range("A9").Value < 20 Then w.PrintOut
Next
End Sub
(Without the reference to w (w.range("a9")), the code is always checking the
activesheet's A9.)
davyb wrote:
Thanks Mike - almost there! - that prints out all of the sheets of the
work book or doesn't print at all according to the value in one
specified cell of the current worksheet.
I would like to print out specified worksheets dependent on the value
in one cell.
So for example if the value =<7 then worksheets 1-4 get printed out. If
the value is 7=<14 then worksheets 1-5 get printed out and so on.
Is this possible do you think?
Another way to frame the logic would be a macro that always prints out
eg sheets 1-3 and looks at the same cell on each sheet 4 and above to
see if there is a value there and if it is there that sheet gets
printed, if not that sheet does not get printed.
--
davyb
------------------------------------------------------------------------
davyb's Profile: http://www.excelforum.com/member.php...o&userid=26401
View this thread: http://www.excelforum.com/showthread...hreadid=396776
--
Dave Peterson