Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CellFormat.Font Property

Office 2007
Returns a Font object, allowing the user to set or return the search criteria based on the cell's font format.

Syntax

expression.Font

expression   A variable that represents a CellFormat object.

Example

This example sets the search criteria to identify cells that contain red font, 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 font of the cell format.
    Application.FindFormat.Font.ColorIndex = 3

    ' Set the color index of the font for cell A5 to red.
    Range("A5").Font.ColorIndex = 3
    Range("A5").Formula = "Red font"
    Range("A1").Select
    MsgBox "Cell A5 has red font"

    ' 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

ADD
Show:
© 2015 Microsoft