ReplaceFormat 属性

       

设置替换条件以用于替换单元格格式。

expression.ReplaceFormat

expression   必需。该表达式返回“应用于”列表中的对象之一。

示例

在下例中,设置了搜索条件以查找文字为 Arial、常规和 10 号字体的单元格,然后将其格式替换为 Arial、加粗和 8 号字体,并通知给用户。

Sub MakeBold()

    ' Establish search criteria.
    With Application.FindFormat.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 10
    End With

    ' Establish replacement criteria.
    With Application.ReplaceFormat.Font
        .Name = "Arial"
        .FontStyle = "Bold"
        .Size = 8
    End With

    ' Notify user.
    With Application.ReplaceFormat.Font
        MsgBox .Name & "-" & .FontStyle & "-" & .Size & _
            " font is what the search criteria will replace cell formats with."
    End With

End Sub