CellFormat.Interior Property (Excel)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns an Interior object allowing the user to set or return the search criteria based on the cell's interior format.

expression .Interior

expression A variable that represents a CellFormat object.

This example sets the search criteria to identify cells that contain a solid yellow interior, creates a cell with this condition, finds this cell, and notifies the user.

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. 
 With Selection.Interior 
 .ColorIndex = 6 
 .Pattern = xlSolid 
 .PatternColorIndex = xlAutomatic 
 End With 
 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