Array Printing (Selecting)

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

Hi there,

I currently print an array of worksheets from within my code, what I would
like do is check a condition on each page before it is added to the array?


Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5", "Sheet6",
"Sheet7", Sheet8", "Sheet9")).Select
Sheets("Sheet1").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

At certain time I would like to exclude various sheets?
Is this possible? or do I have to write code for each possible array
condition?

Thanks Craig
 
Craig,
I used the following sub with the assumption that if Cell A1 was not blank
then print that sheet and loop through all sheets in the workbook checking
if cell A1 was not blank and it would print those sheets where A1 was not
blank. So you could change the conditions for printing based on whatever
criteria you want to use, assuming it is looking at the same thing on each
sheet.

Sub PrintTest()
Dim ShtNum As Integer
For ShtNum = 1 To Sheets.Count
If Worksheets(ShtNum).Cells(1, 1) <> "" Then
Worksheets(ShtNum).PrintOut
End If
Next ShtNum

End Sub

HTH
Wally Steadman (New Guy Learning)
 
Back
Top