Help!

Conditional Printing


Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Printing RSS
Next:  NUMBER LISTS  
Author Message
Mos.StaLL
External


Since: Jul 19, 2007
Posts: 2



PostPosted: Thu Jul 19, 2007 11:26 am    Post subject: Conditional Printing
Archived from groups: microsoft>public>excel>printing (more info?)

Hi,

I would like to know if anyone has any vb script to contionally print
worksheets if a particular cell is > 0. I currently have 25 - 30
worksheets in a workbook and I plan on adding on more sheet to
reference the same cell in each worksheet. If the cell is greater
than 0, I want it to print out that worksheet via a macro assign to a
button. Thanks.

James
Back to top
squenson via OfficeKB.com
External


Since: Jul 26, 2007
Posts: 38



PostPosted: Sun Jul 29, 2007 5:45 am    Post subject: Re: Conditional Printing [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

This macro only prints the sheets that have the value 8 in cell A1. Adapt to
your needs!

Sub PrintOnlySomeSheets()

For Each s In Sheets

If s.Cells(1, 1) = 8 Then ' <--- Adapt the cell position and value
to your needs
Sheets(s.Name).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If

Next

End Sub

--
Message posted via http://www.officekb.com
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Printing All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum