电子表格 VBA,如何用代码给单元格设置颜色?

如题所述

Cells(1, 1).Font.ColorIndex = 3 '字的颜色号为3 红色
Cells(1, 1).Interior.ColorIndex = 3 ' 背景的颜色为3 红色
Cells(2, 1).Font.Color = RGB(0, 255, 0) '字的颜色绿色
Cells(2, 1).Interior.Color = RGB(0, 0, 255) '背景的颜色蓝色
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-10-01
给单元格插入公式,例如:
range("b14").formula="=sum(b1:f3)"
给单元格插入数组公式,例如:
range("a1").formulaarray="=index(sheet1!a:a,small(if(sheet1!$a:$a="
&
chr(34)
&
"张三"
&
chr(34)
&
",row(sheet1!$a:$a),65536),row()))"
第2个回答  2019-03-03

网页链接  这里有, 还有怎么使用的教程

相似回答