Conditional Printing of worksheet

  • Thread starter Thread starter Thor
  • Start date Start date
T

Thor

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.
 
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
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top