Excel Object Model:
Application Object (Excel): Stab Me!!!Font Object (Excel): Stab Me!!!Worksheet Object (Excel): Stab Me!!!
具体使用例子:
- 修改单元格的颜色: 使用单元格的 Interior 类!其中 Color 属性可以修改或是显示单元格的背景颜色!ColorIndex 则是通过数字来修改单元格的背景颜色!
For i = 2 To 19 For j = 2 To 19 If Cells(i, j) = "A" Then Cells(i, j).Select Selection.Interior.Color = RGB(255, 255, 0) '通过选取改变 End If If Cells(i, j) = "C" Then Cells(i, j).Interior.Color = RGB(255, 0, 255) '直接通过单元格来修改 End If If Cells(i, j) = "D" Then Cells(i, j).Select Selection.Interior.ColorIndex = 2 '用索引修改 End If NextNext
VB、VBA、VB.NET 基本差不多,就是类不同罢了!参考:Excel VBA Interior.ColorIndex 色彩列表参考:Interior Object Members待定
你可以用爱得到全世界,你也可以用恨失去全世界