This documentation is archived and is not being maintained.

CellFormat.Borders Property

Office 2007
Returns or sets a Borders collection that represents the search criteria based on the cell's border format.



expression   A variable that represents a CellFormat object.


This example sets the search criteria to identify the borders of cells that have a continuous and thick style bottom-edge, creates a cell with this condition, finds this cell, and notifies the user.

Bb179367.vs_note(en-us,office.12).gif  Note
The default color of the border is used in this example, therefore the color index is not changed.
Visual Basic for Applications
Sub SearchCellFormat()

    ' Set the search criteria for the border of the cell format.
    With Application.FindFormat.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThick
    End With

    ' Create a continuous thick bottom-edge border for cell A5.
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThick
    End With
    MsgBox "Cell A5 has a continuous thick bottom-edge border"

    ' 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