Macro to select and print sheets

J

JoeP

I would like to know the code for use in a macro that will
1. look at cell G1 in a sheet and if there is a number in that cell print
the sheet
2. move to the next sheet and look at cell G1 and if there is a number in
that cell print the sheet
3. continue to move to each sheet in the file test cell G1 to see if there
is a number and print the sheet if there is.

Thanks for any help.
 
D

Don Guillett

something like

for each ws in worksheets
if ws.range("g1")>0 then activesheet.printout
next ws
 
D

Dave Peterson

Option Explicit
Sub testme()

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks.Range("g1")
If IsEmpty(.Value) Then
'skip it
Else
If IsNumeric(.Value) Then
.Parent.PrintOut Preview:=True
End If
End If
End With
Next wks

End Sub
 
Top