查找 CHAR(219) 和 CHAR(220) 然后将其字体更改为 Wingding 3

Find CHAR(219) and CHAR(220) then change its font to Wingding 3

我是 Excel 宏的新手。

我的问题是如何创建一个宏来找到sheet中的CHAR(219)和CHAR(220),然后将其字体更改为Wingding 3。

我不需要更改字体颜色或大小等

Sub SpecialChar()
    Dim strPatt As String
    Dim cel As Range
    Dim regEx As Object
 
    strPatt = "[ÜÛ]" 'change pattern as needed
 
    Set regEx = CreateObject("VBScript.RegExp")
 
    With regEx
        .Global = True
        .MultiLine = True
        .IgnoreCase = True
        .Pattern = strPatt
    End With
 
    For Each cel In Range("A:ZZ").End(xlUp).Row).Cells 'change column as needed
        If regEx.Test(cel.Text) Then
            cel.font.Name = "Wingding 3"
        End If
    Next cel
End Sub

字体是'Wingdings 3',不是'Wingding 3';这应该有效:

Public Sub ChangeThem()
    Dim cel As Range
    For Each cel In ActiveSheet.UsedRange
        If cel = Chr(219) Or cel = Chr(220) Then
           cel.Font.Name = "Wingdings 3"
        End If
    Next cel

End Sub