如何在excel利用VBA将选中单元格中中文改成“宋体”,字符以及数字改成“arial"格式?

2024-12-05 10:23:20
推荐回答(1个)
回答(1):

Sub aa()
Dim str As String
Dim i As Integer
Dim a As Range

Set a = Range("a1:a10") '选择的范围

For Each b In a
str = b.Cells
For i = 1 To Len(str)
If Asc(Mid(str, i, 1)) < 0 Then
b.Cells.Font.Name = "黑体"
Else
b.Cells.Font.Name = "Arial"
End If
Next i
Next
End Sub