View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Print worksheet but dont want two cells too print is it possible

Only press the Print button in the menu
You not have to run a sub

See this page to find the Thisworkbook module
http://www.rondebruin.nl/code.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"pano" wrote in message ps.com...
On Oct 20, 9:10 pm, "Ron de Bruin" wrote:
Seehttp://www.rondebruin.nl/print.htm#Hide

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"pano" wrote in oglegroups.com...
On Oct 20, 8:57 pm, pano wrote:
On Oct 20, 8:46 pm, SeanC UK
wrote:


Hi Stephen,


I don't believe you can prevent individual cells from being printed,
although someone may prove me wrong.


You could try to set the font colour the same as the background colour.
Alternatively you could create a new column, put the information from these
cells in it, and then hide that column.


Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"pano" wrote:
Hi, I have two cells that I dont want to print on a worksheet


I1 & J1


I cant hide the row before printing as there are other cells I want
printed


Has any one done this or have any ideas how this could be
accomplished.


Thanks in advance
Stephen- Hide quoted text -


- Show quoted text -


Ive been hunting and reading


I found this in the archives by Tom O but am having trouble getting
it to work, I gather this would be put in the worksheet .


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.EnableEvents = False
Dim CellArray()
Debug.Print ActiveSheet.Name
If ActiveSheet.Name = "Sheet1" Then
Set nonPrint = Range("C10:E13")
ReDim CellArray(1 To nonPrint.Count)
i = 0
For Each Cell In nonPrint
i = i + 1
CellArray(i) = nonPrint(i).NumberFormat
nonPrint(i).NumberFormat = ";;;"
Next
ActiveSheet.PrintOut
i = 0
For Each Cell In nonPrint
i = i + 1
nonPrint(i).NumberFormat = CellArray(i)
Next
Cancel = True
End If
Application.EnableEvents = True
End Sub


Tom Ogilvy- Hide quoted text -


- Show quoted text -


This is the code I am using to print the sheets , the cells I want to
hide are on sheet "back1" I1 & J1
If I went the format the text to white in those cells where in this
code would I put it????????


Sub Front1()
'Day 1
Application.ScreenUpdating = False
If WorksheetFunction.CountBlank(Sheets("back1A").Rang e("e5:e40")) = 36
Then
Sheets(Array("MDN1", "back1", "front1")).Select
Else
Sheets(Array("MDN1", "back1", "back1a", "front1")).Select
End If
Sheets("front1").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("PrintMenu").Select
Application.ScreenUpdating = True
End Sub- Hide quoted text -


- Show quoted text -



Thanks for the web site Ron
Ok I'm confused.....

I place this in the This Workbook Module (after changing)
Should make the font in Cells Back1 i1 and j1 white for printing then
back to black after printing.

I run it through the debug Sub Front1() runs then calls BeforePrint
but still prints out text in cell i1 and cell j1 in black?????
I must be doing something wrong, Placed something in the wrong
place???

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Back1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False

'Range with one area
With ActiveSheet
.Range("i1:j1").Font.ColorIndex = 2
.PrintOut
.Range("i1:j1").Font.ColorIndex = 1
End With

Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

I run it through the debug Sub Front1() runs then calls BeforePrint
but still prints out text in cell i1 and cell j1 in black?????
I must be doing something wrong

Sub Front1()
'Day 1

Application.ScreenUpdating = False
If WorksheetFunction.CountBlank(Sheets("back1A").Rang e("e5:e40")) = 36
Then
Sheets(Array("MDN1", "back1", "front1")).Select
Else
Sheets(Array("MDN1", "back1", "back1a", "front1")).Select
End If
Sheets("front1").Activate1
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("PrintMenu").Select
Application.ScreenUpdating = True
End Sub