代码改变世界

vba对象/颜色

2021-03-13 06:59  darling达  阅读(600)  评论(0)    收藏  举报

1.Application.Workbooks("Book1").Worksheets("sheet1").Range("A2")。

当前代表的excel程序.工作簿.工作表.单元格.

2.Cells(2,3)代表 2行3列

vba改变单元格字体颜色 cells(1,1).Font.Color = RGB(100, 100, 100)

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) '背景的颜色蓝色