View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Print If statement...

thank you for your help, but how does it know which worksheet to print with
the command line:

Worksheets(wksh).PrintPreview

Do I put all the worksheet names within this like the following:

Worksheets(wksh1, wksh2, wksh3).PrintPreview

Thank you for your help,
Thomas Vanderhoof
"STEVE BELL" wrote:

Something like the below (untested)

change MasterSheet to name of master sheet
change Range("A1:A25") to the appropriate range containing Active
cel.Offset(0,1) means the cell to the immediate right of the cell. change
the 1 to the correct number.
Once you get it working - replace PrintPreview with PrintOut

====================================
Dim wksh As String, cel As Range

For Each cel In Sheets("MasterSheet").Range("A1:A25")
If LCase(cel) = "active" Then
wksh = cel.Offset(0, 1)
Worksheets(wksh).PrintPreview
End If
Next
=========================
--
steveB

Remove "AYN" from email to respond
"Thomas" wrote in message
...
Does anyone know if there is a way to print certain worksheets in a
workbook
based on values in a cell? I'm wanting to print all customers that are
currently active on the status worksheet. Each Customer has there own
worksheet. I would like to print their worksheet based on if they are
marked
"active" on the status worksheet. Any ideas, please feel free to tell me.
--
Thank you,
Thomas Vanderhoof
Noble Phone Services, Inc.