Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 如何更改条件格式单元格的内部颜色索引_Vba_Excel_Format - Fatal编程技术网

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

Vba 如何更改条件格式单元格的内部颜色索引,vba,excel,format,Vba,Excel,Format,如果单元格是有条件格式化的,我不能简单地通过单元格(行、列)更改内部颜色索引。interior.colorindex=6 我试过了,但是单元格的格式丢失了 val = wRes.Cells(i, p) wRes.Cells(i, p).Clear wRes.Cells(i, p).Interior.ColorIndex = 6 wRes.

如果单元格是有条件格式化的,我不能简单地通过
单元格(行、列)更改内部颜色索引。interior.colorindex=6

我试过了,但是单元格的格式丢失了

                    val = wRes.Cells(i, p)
                    wRes.Cells(i, p).Clear
                    wRes.Cells(i, p).Interior.ColorIndex = 6
                    wRes.Cells(i, p) = val
就像某些单元格有日期,其他单元格有“00000”格式的数字一样 丢失。

使用

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

。。。要重新设置单元格的形状,请应用于:现有单元格的范围以排除要更改的单元格。

条件格式将覆盖所有其他格式,因此。。。。无论出于何种目的,您都无法从这里到达那里。如果我清除该单元格,则不会对其应用任何条件格式。请尝试
wRes.Cells(I,p).FormatConditions.Delete
谢谢问题解决