Sub AddSuperScript()
With Selection.Font
.SuperScript = True
End With
End Sub
Sub Macro1()
Dim c As Range
Dim rng As Range
Dim I As Long
Set rng = Range("A1:A10")
For Each c In rng
For I = 1 To Len(c.Value)
If UCase(Mid(c.Value, I, 1)) Like "[A-Z]" Then
c.Characters(Start:=I, Length:=1).Font.Superscript = True
End If
Next I
Next c
End Sub
Great solution, VoG! This was an interesting challenge. I love learning new tricks like this.![]()
If Not IsNumeric(Mid(c.Value, iChr, 1)) Then c.Characters(Start:=iChr, Length:=1).Font.Superscript = True
Thanks, that works great except for one thing - it turns 0 into a superscript. Anyway to avoid that?
David
Sub SuperS()
Dim c As Range, iChr As Integer
For Each c In Selection
For iChr = 1 To Len(c.Value)
If Not IsNumeric(Mid(c.Value, iChr, 1)) Then c.Characters(Start:=iChr, Length:=1).Font.Superscript = True
Next iChr
Next c
End Sub