Cell Format Object

Two new properties of the Application object (FindFormat and Replace-Format) return the CellFormat object that represents the search criteria for the cell format.

■ FindFormat property—Sets or returns the search criteria for the type of cell formats to find

■ ReplaceFormat property—Sets the replacement criteria to use in replacing cell formats



John Brick 248 Adam Bryan 187 Micky Mack 345 Tonyn Walsh_1 19

Sub Reformat()

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

' Set replacement criteria With Application.ReplaceFormat.Font .Name = "Tahoma" .FontStyle = "Bold" .Size = 11 End With

With Application.ReplaceFormat.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThick End With

' Perform the replace

Sheets(1).UsedRange.Replace What:="", Replacement-"", SearchFormat:=True, _ ReplaceFormat:=True

' Reset the Find and Replace formats Application.FindFormat.Clear Application.ReplaceFormat.Clear End Sub

0 0

Post a comment