How to change the interior colorindex of a conditionally formatted cell

If a cell is conditionally formatted I can't simply change the interior color index by cells(row , col).interior.colorindex = 6

I tried this but the format of the cell is lost

                    val = wRes.Cells(i, p)
                    wRes.Cells(i, p).Clear
                    wRes.Cells(i, p).Interior.ColorIndex = 6
                    wRes.Cells(i, p) = val

like certain cells have dates and other have numbers in "00,000" this format are lost.

Answers


Use,

wRes.Cells(i, p).FormatConditions.Delete

... to reshape the Applies to: range of existing Conditional Formatting to exclude the cell you want to change.


Need Your Help

TransactionScope appears not to be working

c# sql-server ado.net

I'm trying to make sure that both my insert and delete below work completely or not at all. I have my connection object outside of my transaction scope which I believe is correct by not 100% sure....