加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

ExcelVBA设置表格颜色

(2019-01-08 22:42:50)
标签:

excel

vba

office

表格

色值方式:
Cells(1,2).Font.ColorIndex = 3 '字的颜色号为3 红色
Cells(1, 2).Interior.ColorIndex = 3 ' 背景的颜色为3 红色
RGB方式:
Cells(2, 3).Font.Color = RGB(0, 255, 0) '字的颜色绿色
Cells(2, 3).Interior.Color = RGB(0, 0, 255) '背景的颜色蓝色
或者比如底色填充范围(Interior):
Range("A3:B4").Interior.ColorIndex = 3
网格线条颜色(Borders):
ActiveWindow.GridlineColorIndex=5'全部
Range("A3").Borders.ColorIndex = 3

边框样式:
Range("A3:B4").Borders.LineStyle = xlContinuous'边线风格
Range("A3:B4").Borders.Weight = xlThick'边线宽度

清除:
Range("A1").Interior.Pattern = xlNone'底色
Cells(1,1).Interior.ColorIndex = xlNone
Cells.Interior.ColorIndex = xlNone'全部底色恢复默认
Cells.Borders.ColorIndex = xlNone'全部边线恢复默认

颜色值:
ExcelVBA设置表格颜色

边线风格:
ExcelVBA设置表格颜色

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有