How to change the interior colorindex of a conditionally formatted cell

﹥>﹥吖頭↗ 提交于 2019-12-11 04:44:26

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/38554685/how-to-change-the-interior-colorindex-of-a-conditionally-formatted-cell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!