Restore cell color after print

powerman

New Member
Joined
Jan 2, 2003
Messages
7
hi, i am using excel 2003. i have a form, inside has several cells for key in data, let's say B2, C5 and D2. i fill the cell with yellow color.
i dont want yelllow color to be print out, and after print out the yellow color still remain there.
i try

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cells.Interior.ColorIndex = xlNone
End Sub

but after print, yellow color cannot restore.

thanks for help.
 
sorry, i am zero in visual basic.

"Paste the code to Standard Module" -- you mean need to insert module then paste the code above ?

Run "RunBeforePrint" before print and "RunAfterPrint" -- dont understand, everytime have to come VBE to do ?


could you email me an excel sample, let me take a look? my email address is power_rider@hotmail.com


thanks.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
1) hit Alt + F11 to open VBE
2) Go To [Insert] - [Module] And Paste the code
3) hit Alt + F11 To get back to Excel
4) Hit Alt + F8 And run "RunBeforePrint"
5) Do whatever you like
6) Hit Alt + F8 and run "RunAfterPrint"
 
Upvote 0
when doing step 6, coming out run time errror "438" object does not support this property or method. when press debug, yellow highlight "Sheets(wsName).x.Interior.ColorIndex = 6"

i prefer the one you gave me before, although need to click 2 times after print preview, more confinient. coz other users dont know press alt+f8. :>
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,172
Members
448,870
Latest member
max_pedreira

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