Listing Using Replace to Replace Formatting

Sub Rep1aceFormats()

' set formatting to look for With Application.FindFormat .Font.Bold = True .Font.Size = 11 End With

' set formatting that should be applied instead With Application.ReplaceFormat .Font.Bold = False .Font.Italic = True .Font.Size = 8 End With

ActiveSheet.Cells.Replace What:="", Rep1acement:="", SearchFormat:=True, Rep1aceFormat:=True

End Sub

In the next chapter, you'll be looking at some of the formatting related objects in more detail. The main thing to point out here is that, when you only want to replace formats, you must use an empty string for both the What parameter and the Replacement parameter.

0 0

Post a comment