Skip to content
本页内容

Borders (属性)

返回或设置一个 Borders 集合,它代表基于单元格边框格式的搜索条件。

示例

python
#本示例设置搜索条件以识别单元格的边框,这些单元格具有连续、加粗样式的底部边缘。创建一个满足该条件的单元格,然后找到该单元格并通知用户
def test():
    # Set the search criteria for the border of the cell format.
    border = Application.FindFormat.Borders.Item(xlEdgeBottom)
    border.LineStyle = xlContinuous
    border.Weight = xlThick
    #  Create a continuous thick bottom-edge border for cell A5.
    Application.Range("A5").Select()
    Application.Selection.Borders.Item(xlEdgeBottom).LineStyle = xlContinuous
    Application.Selection.Borders.Item(xlEdgeBottom).Weight = xlThick
    Application.Range("A1").Select()
    print("Cell A5 has a continuous thick bottom-edge border")
    #  Find the cells based on the search criteria.
    Cells.Find("", ActiveCell, xlFormulas, xlPart, xlByRows, xlNext, False, None, True).Activate()
    print("ET has found this cell matching the search criteria.")
python
#本示例将替换条件中单元格底部边框的颜色设置为红色
def test():
    Application.ReplaceFormat.Borders.Item(xlEdgeBottom).Color = RGB(255, 0, 0)