Share via


Interior Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

Interior property as it applies to the CellFormat object.

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

expression.Interior

expression   Required. An expression that returns one of the above objects.

Interior property as it applies to all other objects in the Applies To list.

Returns an Interior object that represents the interior of the specified object.

expression.Interior

expression   Required. An expression that returns one of the above objects.

Example

As it applies to the 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.
    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

As it applies to all other objects in the Applies To list.

This example sets the interior color for cell A1 on Sheet1 to cyan.

  Sub SetColor()

    Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 8  ' Cyan

End Sub