Name

Application.ReplaceFormat [= setting]

Synopsis

Sets or returns the CellFormat object used when reformatting during search and replace. For example, the following code replaces all bold with italic:

Sub TestReplaceFormat(  )
    Dim fBold As CellFormat, fItal As CellFormat
    Set fBold = Application.FindFormat
    Set fItal = Application.ReplaceFormat
    fBold.Font.Bold = True
    fItal.Font.Bold = False
    fItal.Font.Italic = True
    Cells.Replace "", "", , , , , True, True
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.