0
Thanks

A few words of thanks would be greatly appreciated.

Excel - A macro to change the color of row on condition



Issue


I have a problem regarding Macro of excel 2007. Suppose I have a Excel tab(xyz) which have some column(name, add, Date). I want to create a macro which will mark total row as RED if the date is today.

Solution


Look at conditional formatting.
  • Highlight the cells that you wish to be red when the date in the cell in question is today's date.
  • Click on conditional formatting/new rules
  • Select 'use a formula to determine which cells to format'
  • Click on the little spreadsheet icon.
  • Click on the cell with the date that you need to use.
  • Put the following formula in the field after the cell reference - in my case

=$C$3

So, the field should look like this =$C$3 = today()
  • Click on the spreadsheet icon again.
  • Click on the format button bottom right.
  • Select the format you wish to appear in the row/cells when the date is today.
  • Click on ok, then apply.


Now, test the results by putting today's date in the cell that will have the trigger date in.

Thanks to sharpman for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by Jean-François Pillou.

This document, titled "Excel - A macro to change the color of row on condition," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments