Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Print macro to exclude a cell

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Print macro to exclude a cell

I'd start by looking at Ron de Bruin's site:
http://www.rondebruin.nl/print.htm#Hide

JaimeLex wrote:

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Print macro to exclude a cell

Thank you so much! That was perfect. It worked to a "T".

"Dave Peterson" wrote:

I'd start by looking at Ron de Bruin's site:
http://www.rondebruin.nl/print.htm#Hide

JaimeLex wrote:

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Print macro to exclude a cell

Your code would need to go into the Workbook's _BeforePrint() event handler.

This is going to be a bit tough to do because you've got cell C10 being
setup for display with conditional formatting. IF the color of the cell's
font is part of the conditional formatting then just setting the cell's
regular/default font color is not going to have any effect - the conditional
formatting will override it.

A way around the above, if that's the case, would be to set up another
condition ahead of the one you have already that says if a certain value is
in some other cell, then to set the font color to white. Then your
_BeforePrint() code would set the value in that other cell to the value that
causes the font to become white.

The problem is made more complicated by the fact that while the
_BeforePrint() code can set that special value in the other cell, you cannot
include code in it to change that value so that the text in C10 is once again
colored red. All the code in that module is executed before the printing is
started.

What you can do is then add code to the sheet that C10 is in, in that
worksheet's _SelectionChange() event code to set that other special value to
anything other than the "make C10 font white" value. That would fire each
time you move from one area/cell on that sheet to another area/cell on it.
Since you can't move around while printing, any movement you make would be
while not printing and would cause C10 to appear visible to you ... you just
have to click another cell on that sheet after printing is completed to make
C10 visible again.


"JaimeLex" wrote:

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Print macro to exclude a cell

Ron does nice work!

JaimeLex wrote:

Thank you so much! That was perfect. It worked to a "T".

"Dave Peterson" wrote:

I'd start by looking at Ron de Bruin's site:
http://www.rondebruin.nl/print.htm#Hide

JaimeLex wrote:

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Print macro to exclude a cell

And he thinks of a nice way to attack things - I was thinking of attacking it
through the _BeforePrint() process, as opposed to "make the change ... do the
print ... reverse the change" which is not a 100% satisfactory solution -
could be if you could detect when the printing has finished/file has been
sent to the spooler.


"Dave Peterson" wrote:

Ron does nice work!

JaimeLex wrote:

Thank you so much! That was perfect. It worked to a "T".

"Dave Peterson" wrote:

I'd start by looking at Ron de Bruin's site:
http://www.rondebruin.nl/print.htm#Hide

JaimeLex wrote:

Hi,

I'm completely new to macros and having a tough time getting this to work.
I've got an IF statement in a merged cell of my worksheet (Cell B10). Text
appears in the cell if a certain condition is met.

I want to create a macro for this workbook only that will change the font in
cell B10 to white prior to printing and back to the red I selected after
printing. Is there a way for this to run automatically when a user prints
this workbook?

Any help would be great as this is my first macro and I'm not sure where to
start...

--

Dave Peterson


--

Dave Peterson

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
SUMIF Exclude Certain Cell Steph Excel Worksheet Functions 4 September 30th 10 08:43 PM
Exclude Cell from Calculation KenCQE Excel Discussion (Misc queries) 2 March 21st 07 11:05 AM
Sort Macro to Exclude Blank Rows? ScottPcola Excel Worksheet Functions 1 January 5th 06 07:10 PM
How do I exclude a cell from an average calculation when the cell. Sam Excel Discussion (Misc queries) 1 September 7th 05 05:16 PM
Exclude a cell from calculating Drew Excel Worksheet Functions 2 February 4th 05 08:05 PM


All times are GMT +1. The time now is 11:21 PM.

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

About Us

"It's about Microsoft Excel"