Export (0) Print
Expand All

CellFormat.Interior Property

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



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.

Visual Basic for Applications
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

Community Additions

© 2015 Microsoft