应用于 CellFormat 对象的 Interior 属性。
应用于“应用于”列表中的其他所有对象的 Interior 属性。
应用于 CellFormat 对象的 Interior 属性。
本示例设置搜索条件以识别内部为纯黄色的单元格,创建满足该条件的单元格,找到该单元格,并通知给用户。
Sub SearchCellFormat()
' Set the search criteria for the interior of the cell format.
With Application.FindFormat.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
' Create a yellow interior for cell A5.
Range("A5").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("A1").Select
MsgBox "Cell A5 has a yellow interior."
' Find the cells based on the search criteria.
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
MsgBox "Microsoft Excel has found this cell matching the search criteria."
End Sub
应用于“应用于”列表中的其他所有对象的 Interior 属性。
本示例将 Sheet1 中 A1 单元格的内部颜色设为青色。
Sub SetColor()
Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 8 ' Cyan
End Sub