+ Reply to Thread
Results 1 to 5 of 5

script to replace 3 fonts in multiple Excel SS's.

Hybrid View

  1. #1
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: script to replace 3 fonts in multiple Excel SS's.

    Martin was on the right track. You just need to include a few if statements to query for specific font types.

    The code below is a sample that can be modified. It changes any ARIAL fonts to Times New Roman

    Sub Change_Fonts()
        Dim cel As Range
        Dim rng As Range
        
        Set rng = ActiveSheet.UsedRange
        With Application
            .ScreenUpdating = False
            
        For Each cel In rng
            If cel.Font.Name = "Arial" Then
                cel.Font.Name = "Times New Roman"
            End If
        Next cel
        
            .ScreenUpdating = True
        End With
        
    End Sub

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: script to replace 3 fonts in multiple Excel SS's.

    ok i took bigbas's code had a think and reworked it thus
    Sub Change_Fonts()
    Application.ScreenUpdating = False
        Dim cel As Range
        Dim rng As Range
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
      
             
        Set rng = ws.UsedRange
       For Each cel In rng
        Select Case True
        Case cel.Font.Name = "Times New Roman CE"
                cel.Font.Name = "Arial"
        Case cel.Font.Name = "Times New Roman Greek"
                cel.Font.Name = "Arial"
        Case cel.Font.Name = "Times New Roman TUR"
                cel.Font.Name = "Arial"
        
         End Select
        Next cel
      Next ws
        Application.ScreenUpdating = True
    End Sub
    change font names to suit
    i think this works ok i tested it and it works for me
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1