need code for changing the fill color of cells to white when printing, then change back when printing is compelte

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
458
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have a worksheet where the background color of the sheet (using fill color) is tan like color, but when the user goes to print the worksheet I just need it to print with no fill, but I want it to change back to the original fill color when printing is done. Thank you
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Maybe something like this will work:

Code:
With Sheets("Sheet1")
    myColor = .Range("A1").Interior.Color
    .Cells.Interior.Color = xlNone
    .PrintOut
    .Cells.Interior.Color = myColor
End With

They will need to run the macro to print rather than press the print button
 
Upvote 0
Maybe something like this will work:

Code:
With Sheets("Sheet1")
    myColor = .Range("A1").Interior.Color
    .Cells.Interior.Color = xlNone
    .PrintOut
    .Cells.Interior.Color = myColor
End With

They will need to run the macro to print rather than press the print button

Thats perfect. Did the trick. Thank you Steve.

Now, I also have several Objects on the sheet that are also filled with color. What code would I add to this to have either all the objects on the sheet NOT filled, or, individual ones not filled when printing? Thank you again
 
Upvote 0
Do they all have the same fill colour?
No. Its an org chart and I am limiting control over what the user can and cannot do. Additionally, because of the color of the worksheet I dont need it nor want it to print out in color on our printer. Here is the snippet of the sheet to give you an idea of what I am working with. I decidde against using the installed excel (or even word for that matter) template for an org chart because some of the features I have in this one is not possible using the supplied template. THanks again!
334jfw4.jpg
 
Upvote 0
Do they all have the same fill colour?
Never mind, I got it (you got me far enough along with the code, and from there I was able to record a macro and copy and paste that code into the code you supplied. Thanks for your help!) :)
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top