View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default printing selected sheets

Hi Andy

This test cell A1 on each sheet
Change PrintPreview to printout if you like it


Sub Print_Visible_Worksheets()
'xlSheetVisible = -1
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Visible = -1 Then
If sh.Range("A1").Value < "" Then
sh.PrintPreview
End If
End If
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"andy" wrote in message ...
I have been fiddling around for a while now trying to get my workbook to only
print worksheets that have data on them. Im quite new to visual basic and not
that great at it.

Is it possible to run a macro that can look to see if certain cells are
empty in a worksheet, and if so, not print that worksheet and go onto the
next one? So that it only prints worksheets that have had data entered onto
them.

If so, could you give me ideas on how to do it?