Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printing Selected worksheets but exclude the sheet "Sheets" | Excel Discussion (Misc queries) | |||
Printing a selected spreadsheet | Excel Discussion (Misc queries) | |||
Printing selected sheets. | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
Having trouble printing selected sheets in Excel | Excel Discussion (Misc queries) |