Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Print current worksheet excluding a few cells

Hi,

I'm writing a diary of what I do at work every day. At the end of the month
I print out a copy to report my time. But I don't want to print out what
I've been doing, only the time part. So a range of cells need to be empty.
How can I achieve this without cut/paste between print? A macro would be
great!
Thanks!

--
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print current worksheet excluding a few cells

Hi Daniel

You can make the text in the range White and print

Sub test1()
'Range with one area
With ActiveSheet
.Range("B10:B14").Font.ColorIndex = 2
.PrintOut
.Range("B10:B14").Font.ColorIndex = 1
End With
End Sub

Sub test2()
'Range with more areas
With ActiveSheet
.Range("A1:A3,B10:B14,C12").Font.ColorIndex = 2
.PrintOut
.Range("A1:A3,B10:B14,C12").Font.ColorIndex = 1
End With
End Sub


For more Print example's see
http://www.rondebruin.nl/print.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel Lidström" wrote in message ...
Hi,

I'm writing a diary of what I do at work every day. At the end of the month
I print out a copy to report my time. But I don't want to print out what
I've been doing, only the time part. So a range of cells need to be empty.
How can I achieve this without cut/paste between print? A macro would be
great!
Thanks!

--
Daniel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Print current worksheet excluding a few cells

"Ron de Bruin" wrote in message
...
Sub test1()
'Range with one area
With ActiveSheet
.Range("B10:B14").Font.ColorIndex = 2
.PrintOut
.Range("B10:B14").Font.ColorIndex = 1
End With
End Sub
"Daniel Lidström" wrote in message

...
Hi,

I'm writing a diary of what I do at work every day. At the end of the

month
I print out a copy to report my time. But I don't want to print out what
I've been doing, only the time part. So a range of cells need to be

empty.
How can I achieve this without cut/paste between print? A macro would be
great!
Thanks!

--
Daniel


This will only work if the "black and white" checkbox on the Page Setup -
Sheet tab is deselected.

Another method would be to use Range("B1").EntireColumn.Hidden = True/False
in place of Ron's ColorIndex lines. This will only work if the data you want
hidden is in it's own column (or row using EntireRow).

If you want it automated (ie to run when you click the print button) you
could use:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("B1").EntireColumn.Hidden = True
Application.OnTime earliesttime:=Now + TimeSerial(0, 0, 3),
procedu="UnhideColumns"
End Sub

Sub UnhideColumns()
Range("B1").EntireColumn.Hidden = False
End Sub

This hides column B if print or print preview is selected, then calls
UnhideColumns 3 seconds later. This gives sufficient time for the output to
be sent to print. In the case of print preview, it will not activate until
the preview is closed.

Ian



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Print current worksheet excluding a few cells

On Thu, 09 Sep 2004 15:28:29 GMT, IC wrote:

Another method would be to use Range("B1").EntireColumn.Hidden = True/False
in place of Ron's ColorIndex lines. This will only work if the data you want
hidden is in it's own column (or row using EntireRow).

If you want it automated (ie to run when you click the print button) you
could use:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("B1").EntireColumn.Hidden = True
Application.OnTime earliesttime:=Now + TimeSerial(0, 0, 3),
procedu="UnhideColumns"
End Sub

Sub UnhideColumns()
Range("B1").EntireColumn.Hidden = False
End Sub

This hides column B if print or print preview is selected, then calls
UnhideColumns 3 seconds later. This gives sufficient time for the output to
be sent to print. In the case of print preview, it will not activate until
the preview is closed.


This is good. But I want only a range to be hidden: Q5:Q29. The problem is
that I can't hide column Q because of merged cells. Q5 spans from Q5 to V5.
Is there a way to keep cells Q5:Q29 from being printed? I don't necessarily
want them hidden. Perhaps cut before print, paste back 3 seconds later?

--
Daniel
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I print a worksheet excluding blank rows? lohme Excel Worksheet Functions 13 August 23rd 06 10:36 PM
HOW DO I REDUCE THE SIZE OF A WORKSHEET TO THE CURRENT USED CELLS RWood Excel Worksheet Functions 6 January 14th 06 07:12 PM
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. [email protected] Excel Discussion (Misc queries) 0 September 22nd 05 04:39 PM
How can I print current row in same place on paper but not print surrounding cells??? Andy Ford New Users to Excel 1 September 2nd 05 05:50 AM
keeping a print header tied to a worksheet cell current Paul James[_3_] Excel Programming 6 January 24th 04 11:12 PM


All times are GMT +1. The time now is 05:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"