Excel VBA删除条件格式保留边框 [英] Excel VBA Remove Conditional formatting keep borders
本文介绍了Excel VBA删除条件格式保留边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经找到一个线程,其中条件格式被删除,但是格式保留。
如果我运行脚本,我将失去边框的条件格式。还有可能将所有信息保留在边界?
最佳,
Alex
解决方案
在内使用aCell
块,您可以尝试添加以下内容:
<$ p $对于b = 1到b
.Borders(b).LineStyle = .DisplayFormat.Borders(b).LineStyle
.Borders( b).Color = .DisplayFormat.Borders(b).Color
.Borders(b).Weight = .DisplayFormat.Borders(b).Weight
下一个
ps我使用数值来枚举 xlEdgeTop
, xlEdgeLeft
等...,以缩短代码循环。 / p>
I have found a thread where the conditional formatting is removed but the format is kept.
If I run the script I am losing the conditional formatting of the borders. Is it also possible to keep all information on the border?
Best, Alex
解决方案
Inside the With aCell
block, you can try adding this:
Dim b as long
For b = 1 To 12
.Borders(b).LineStyle = .DisplayFormat.Borders(b).LineStyle
.Borders(b).Color = .DisplayFormat.Borders(b).Color
.Borders(b).Weight = .DisplayFormat.Borders(b).Weight
Next
p.s. I used numeric values for the enumeration xlEdgeTop
, xlEdgeLeft
etc..., to shorten the code with a loop.
这篇关于Excel VBA删除条件格式保留边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文