Macros

Ideal Font Style

VBA: Ideal Font Style

Sub Ideal_Font()
'This macro changes the font name and size of each (non-heading) style to that that preferred for the presentation of your excel workings; obtained from bgrconsulting.co.uk/macros where help and support can be found.
    Std = MsgBox("Would you like to just use Aptos Narrow, Size 8?", vbYesNo, "Use Aptos Narrow, 8?")
    If Std = vbNo Then GoTo Begin
    For Each Style In ActiveWorkbook.Styles
        If Style Like "*Heading*" Or Style Like "*Total*" Or Style Like "*Title*" Then GoTo NxtS1
        Style.Font.Name = "Aptos Narrow"
        Style.Font.Size = 8
NxtS1:
    Next Style
    Exit Sub
    
Begin:
    FName = InputBox("Which font would you like to use?" & vbNewLine & vbNewLine & "NB: 'A' = 'Arial' and 'C' = 'Calibri'; write out other fonts in full.", "Font Name?")
    If FName = "" Then Exit Sub
    If FName = "A" Or FName = "a" Then FName = "Arial"
    If FName = "C" Or FName = "c" Then FName = "Calibri"
    
    FSize = InputBox("What size would you like the font to be?", "Font Size?")
    If FSize = "" Then Exit Sub
    
    If MidSub <> vbYes Then Call TurnStuffOff
    
    On Error GoTo Leave
    For Each Style In ActiveWorkbook.Styles
        If Style Like "*Heading*" Or Style Like "*Total*" Or Style Like "*Title*" Then GoTo NxtS2
        Style.Font.Name = FName
        Style.Font.Size = FSize
NxtS2:
    Next Style
    
    If MidSub <> vbYes Then Call TurnStuffOn
Exit Sub

Leave:
    Retry = MsgBox("The font size must be input as an integer." & vbNewLine & vbNewLine & "Would you like to try again?", vbCritical + vbYesNo, "Retry?")
    If Retry = vbYes Then GoTo Begin
    If MidSub <> vbYes Then Call TurnStuffOn
End Sub