Click here to Skip to main content
15,180,555 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I have created a excel template with Visual Studio (c#) to fill the worksheet with some data.
On this worksheet I want to add some conditional formatting of the cells. I want the user of the template to fill in a "Yes" or a "No" and make the cell green / red depending on the value of the cell. Any idea how to do this?

I found a lot on the net about conditional formatting, but I can't figure out how to do this. :confused:

1 solution

This article goives a good exmple for conditional formatting programmatically:

Setting Conditional Formatting in Excel 2007[^]

DD Says...Rick, I use this quite a lot, but if I borrow your brain, I have not found out a way of doing it for dates.
That is, if a date is over 60 days, I would like that cell highlighted.
I can only do it by a macro, not CondForming, unless you know better?

Dave, You can use Today()-60 with a "less than" rule. Rick

DD...Do you know that was so obvious it never occurred to me? :~

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900