简体   繁体   English

如何更改有条件格式的单元格的内部颜色索引

[英]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 如果单元格是有条件格式化的,我不能简单地按cells(row , col).interior.colorindex = 6更改内部颜色索引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. 比如某些单元格有日期而其他单元格中的数字为“00,000”,这种格式会丢失。

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. ...重塑适用于:现有条件格式的范围,以排除要更改的单元格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM