Skip to content
本页内容

Interior (属性)

返回一个 Interior 对象,该对象允许用户根据单元格内部格式设置或返回搜索条件。

示例

python
#此示例设置搜索条件以识别内部为纯黄色的单元格,创建满足该条件的单元格,找到该单元格,并通知给用户
def test():
    # Set the search criteria for the interior of the cell format.
    interior = Application.FindFormat.Interior
    interior.ColorIndex = 6
    interior.Pattern = xlSolid
    interior.PatternColorIndex = xlAutomatic

    # Create a yellow interior for cell A5.
    Application.Range("A5").Select()
    Application.Selection.Interior.ColorIndex = 6
    Application.Selection.Interior.Pattern = xlSolid
    Application.Selection.Interior.PatternColorIndex = xlAutomatic
    Range("A1").Select()
    print("Cell A5 has a yellow interior.")

    # Find the cells based on the search criteria.
    Application.Cells.Find("", ActiveCell, xlFormulas, xlPart, xlByRows, xlNext, False, None, True).Activate()
    print("ET has found this cell matching the search criteria.")
python
#此示例显示查找条件中单元格的内部颜色是否为黄色
def test():
    print(Application.FindFormat.Interior.Color == RGB(255, 255, 0))