Clear and restore conditional formatting of different cells before printing

  • Hi VBA-experts,
    I'm looking for a working code to clear conditional formatting of different cells before printing and restore them after printing. The macro should run automatically when I want to print the specific worksheet and also restore the conditional formatting after printing. The removal of the conditional formatting cells should be visible on the print preview of the Excel document.


    I had an idea for some basic code but it is far from complete. (no use of buttons or datavalidation please and the final document is printed in color (but not the cleared conditional formatting cells))
    Any help would be greatly appreciated.

    Code
    Private Sub Workbook_BeforePrint(Cancel As Boolean) 
         
         
        Sheets("Sheet1").Range("B6,B10").FormatConditions.Delete 
         
    End Sub


    [COLOR="#FF0000"]MOD Edit[/COLOR]:
    Moved from the Word forum.

  • Re: Clear and restore conditional formatting of different cells before printing


    Is this the same issue as posted here on this forum...?


    In addition:

    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    *

  • Re: Clear and restore conditional formatting of different cells before printing


    This thread is an updated, clearer and slightly different version of that post, indeed. Since noone answered in that post, I thought to alter the question in a clearer and "easier to solve?" way. I can't find the edit button on the previous thread.

  • Re: Clear and restore conditional formatting of different cells before printing


    You can't edit after a certain time - but you could have added a reply saying you had reposted with a link to the new post. I'll close that thread.


    As requested, please add links to your posts on other forums for this issue. You agreed to do that if you posted the same issue on multiple forums, when you joined here.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!