Thread: Auto Correction
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Auto Correction

You can do that with this event sub:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Characters(Start:=InStr(1, Target, "mm2") + 2,
Length:=1).Font.Superscript = True
End Sub

You can refine the sub if you want to apply it only to a certain range, e.g.
column A:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then Target.Characters(Start:=InStr(1, Target,
"mm2") + 2, Length:=1).Font.Superscript = True
End Sub

Regards,
Stefi


€˛Hi_no_Tori€¯ ezt Ć*rta:

Hi...
Can I format a cell, so that when I enter for example: "120 mm2", the "2" is
converted automatically to superscript.