![]() |
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? |
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? |
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? |
All times are GMT +1. The time now is 06:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com