Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default printing selected sheets

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default printing selected sheets

thats great cheers, thanks very much

"Ron de Bruin" wrote:

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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Selected worksheets but exclude the sheet "Sheets" Dolphinv4 Excel Discussion (Misc queries) 1 January 3rd 08 12:13 PM
Printing a selected spreadsheet Joan@CCSG Excel Discussion (Misc queries) 3 July 6th 07 09:12 AM
Printing selected sheets. Rafat Excel Worksheet Functions 1 June 9th 06 03:13 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
Having trouble printing selected sheets in Excel lost in the world Excel Discussion (Misc queries) 1 April 26th 05 06:24 PM


All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"