ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell invisible when printed. (https://www.excelbanter.com/excel-programming/414233-cell-invisible-when-printed.html)

Jim[_8_]

Cell invisible when printed.
 
Is there a way to have a cell visible on screen but invisible when
printed?

Peter T

Cell invisible when printed.
 
Here's one approach -

Format the font colour in cells you want to print non-visible with say
color-index 56. That's the almost black colour on the top right of the 40/56
colour palette.

' In the Thisworkbook module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim origClr As Long

origClr = ThisWorkbook.Colors(56)
ThisWorkbook.Colors(56) = RGB(255, 255, 255) ' white

Application.OnTime Now, "'reSetPrintClr " & origClr & "' "
End Sub

' In a normal module

Sub reSetPrintClr(nClr As Long)
ThisWorkbook.Colors(56) = nClr
End Sub


If you want some other palette colour, record a macro while applying some
format with your colour, the colorindex will be recorded. As written, cells
on white backgrounds will be hidden whilst printed. For testing without
printing, activate the print dialog (File, print), have a look, then abort
the print

Come back if your not sure of the difference between "Thisworkbook" and
"normal" modules.

Regards,
Peter T


"Jim" wrote in message
...
Is there a way to have a cell visible on screen but invisible when
printed?





All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com