Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I print a worksheet excluding blank rows? | Excel Worksheet Functions | |||
HOW DO I REDUCE THE SIZE OF A WORKSHEET TO THE CURRENT USED CELLS | Excel Worksheet Functions | |||
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. | Excel Discussion (Misc queries) | |||
How can I print current row in same place on paper but not print surrounding cells??? | New Users to Excel | |||
keeping a print header tied to a worksheet cell current | Excel Programming |