Sub Clearall()
Dim Ws As Worksheet
Set Ws = ThisWorkbook.Sheets("Sheet1")
Dim Clrallblue As Range
Set Clrallblue = Range("C14:I19")
For Each Cell In Clrallblue.Cells
With Cell
.ClearContents
.Borders.LineStyle = XlLineStyle.xlContinuous
.Interior.ColorIndex = RGB(153, 204, 255)
End With
Next Cell
End Sub
答案 0 :(得分:3)
.ColorIndex
需要一个整数值。如果您想使用RGB,请使用.Color
。
答案 1 :(得分:1)
ColorIndex不接受RGB请在这里查看全彩色索引表: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/colorindex-property