This project has moved and is read-only. For the latest updates, please go here.

Conditional Formatting: Color Row

Sep 9, 2013 at 1:00 PM
Hi all.
Is it possible to color an entire row depending on a cell value?
I searched everywhere and nothing found.
Thanks
Sep 9, 2013 at 2:19 PM
See Conditional Formatting in the documentation page
Sep 12, 2013 at 8:09 AM
Thank you for the reply. I have taken a look at these examples and more that I found on google, but I still have the same problem.
All I find is how to color a cell, not a row. Isn't it possible?
Sep 12, 2013 at 8:52 AM
I finally found a solution.
The example for "Using Formulas" induced me to error.

If I use .WhenEquals() doesn't work, I have to use .WhenIsTrue()

Here is how I color a row from A to N depending on the value of M column:
ws.Range("A1:N100").AddConditionalFormat().WhenIsTrue("=$M1=\"Hello\"").Fill.SetBackgroundColor(XLColor.Gray);
And here is how it is shown on Excel:
Image

It works correctly.
Thanks.