View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Conditional Printing of worksheet

Hi Thor,

Try something like:

'=============
Public Sub Tester001()

Dim rng As Range

Set rng = ActiveWorkbook.Sheets("Sheet1").Range("A55")

If rng.Value = 1 Then
Sheets("Sheet1").PrintOut
ElseIf rng.Value = 2 Then
Sheets(Array("Sheet1", "Sheet2")).PrintOut
End If
End Sub
'<<=============


---
Regards,
Norman


"Thor" wrote in message
...

Hello...
I have 2 worksheets that I need to print out based on a cell value in a
third worksheet written as a macro. Example of sheets named: Sheet1,
Sheet2, Sheet3.
Sheet1 contains the control variable in Cell A55. If a value of 1 is in
cell A55, then I wish to print only Sheet1 when the macro is run. If a
value of 2 is in this cell, then I wish to print both Sheet1 and Sheet2
when the macro is run. Simple? Maybe for the VB'ers. Any idea??

Thanx as always. Thor.


--
Thor
------------------------------------------------------------------------
Thor's Profile:
http://www.excelforum.com/member.php...fo&userid=1049
View this thread: http://www.excelforum.com/showthread...hreadid=500474