View Full Version : Hiding Cells fore print layout


Jordan2000
12-01-2005, 02:07 AM
Hello,

I am having a problem I have a few repports in excel and those have some sensitive data dat never ever is allowd to make a hard copy.
i protected the sheets against selecting and copy. but no I need to protect a smal range of the repport to be protected against printing.

like the rows 55 to 65 is not allowd but the rapportage is in the range 1 to 100 so how can i do this ?

it may be visible on the screen but when making a hard copy to the printer it is not allowd to do.. for that range so that range need to be blanked out.

shades
12-01-2005, 05:47 AM
Howdy. You can use a workbook event in VBA (BeforePrint) so that you could hide rows 55:66 before print. Something like this:


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Rows("8:20").EntireRow.Hidden = True
End Sub


To enter this code in the proper place, go to the XL icon to the left of the File menu, right-click and choose "View Code"

HaHoBe
12-01-2005, 09:50 AM
Hi, Jordan2000,

maybe Invisible Ink (http://www.dicks-blog.com/archives/2004/04/01/invisible-ink/) could be of good use.

Ciao,
Holger

Stacey
06-22-2006, 05:39 AM
Is there a way to hide the columns only during printing, and have them show up again after the spreadsheet is printed?

HaHoBe
06-22-2006, 08:47 AM
Hi, Stacey,

I would prefer a normal printing job to the workbook-event whioch should be disabkled (Cancel = True) as that will not allow to determine if the printing really has been done or not. (only to my limited knowledge).

Ciao,
Holger