代码1:快速删除所选单元格中的上标字符
'删除所选单元格区域中所有上标
Sub DeleteSuperScript()
Dim rng As Range
Dim i As Long
'确保选择的是单元格区域
If TypeName(Selection) "Range" Then Exit Sub
'关闭屏幕刷新
Application.ScreenUpdating = False
'遍历所选单元格
For Each rng In Selection.Cells
'遍历单元格中的每个字符
For i = 1 To Len(rng.Value)
'判断是否为上标
If rng.Characters(i,1).Font.Superscript = True Then
'删除
rng.Characters(i, 1).Delete
i = i - 1
End If
Next i
Next rng
'恢复屏幕刷新
Application.ScreenUpdating = True
End Sub
代码2:快速取消所选单元格中的字符上标格式
'取消所选单元格中所有上标
Sub RemoveSuperScript()
Dim rng As Range
Dim i As Long
'确保选择的是单元格区域
If TypeName(Selection) "Range" Then Exit Sub
'关闭屏幕刷新
Application.ScreenUpdating = False
'遍历所选单元格
For Each rng In Selection.Cells
'遍历单元格中的每个字符
For i = 1 To Len(rng.Value)
'判断是否为上标
If rng.Characters(i, 1).Font.Superscript =True Then
'取消上标格式
rng.Characters(i,1).Font.Superscript = False
End If
Next i
Next rng