Highlight cells in sheets based on specific cells conditional formatting

  • Hi. I've tried my best to make my own code.

    My aim is to highlight the cells in the other sheets based on the dates in D20, E21 and E20.


    Here's what I tried by recording what I wanted to do. Unfortunately, it isn't able to highlight the cells that I want to be highlighted. The code works only to make the dates into the format that I want but it isn't able to copy and paste to the conditional formatting and do the highlighting. May I know what I can do to the code to highlight the cells containing the dates in D20, E21, and E20?


    D20 = contains the date today in ddmmmyy

    E20 = contains the next working date in ddmmmyyy

    E21 = contains the date today in ddmmmyyyy


    Cells with date today (D20 and E21) should be in yellow

    Cells with next working date (E20) should be in blue


    Appreciate any help please. Thanks.

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post


    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.


    How to use code tags


    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Thanks.

    • Why do you need VBA for this. Your Thread Title actually states what you should be using, i.e. Conditional Formatting.
    • Images don't help with this, attach an example workbook.
  • Because there are many sheets and it's time consuming to do it manually via conditional formatting for each sheet.

  • I cannot attach a workbook as it would be sensitive company info. I need a macro that will do the samw thing that conditional formatting does for all the sheets.

Participate now!

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