Macro to test characters with block of cells and change font
Here's the final macro that we've implemented. It could probably be
streamlined a bit more, but it's functional and meets our needs. Enjoy!
Carolyn
Option Explicit
Sub SuperscriptLetters()
Dim cell As Range
Dim i As Integer
On Error Resume Next 'in case nothing found
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
If Len(cell) 0 Then
For i = Len(cell) To 1 Step -1
If Not (IsNumeric(Mid(cell, i, 1)) Or Mid(cell, i, 1) = "%" Or
Mid(cell, i, 1) = "$" Or Mid(cell, i, 1) = "." Or Mid(cell, i, 1) = ",") Then
With cell.Characters(Start:=i, Length:=1).Font
.Superscript = True
' .Bold = True
End With
End If
Next i
If Not (IsNumeric(cell)) Then
With cell.Characters.Font
' .Bold = True
.FontStyle = "Bold"
End With
End If
End If
Next cell
End Sub
|