Sub xxx()
Dim rg As Range, i As Integer
For Each rg In Application.Selection
悔烂If rg Like "*[[]*[]]*" Then
rg.Characters(InStr(rg, "["), Len(Mid(rg, InStr(rg, "]"), InStr(rg, "]") - InStr(rg, "[") + 1))).Font.Superscript = False
桥扒 rg.Characters(InStr(rg, "["), Len(Mid(rg, InStr(rg, "]"), InStr(rg, "]") - InStr(rg, "[") + 1))).Font.Subscript = True
敏前昌 End If
Next
End Sub
里面那一层for可以不要,改成这样
要选择区域里有[*]格式的才有效果。
*是通配符
比如 [2]、[平方]就会被找到并格式化