H
Helene
I do some work for a company that abbreviates its own name with two capital
letters and a superscript "2". Usually when they type this abbreviation in
their own documents they use that special character that appears to be a
superscript 2 but is not a 2 superscripted, if you follow that.
When they send me documents, the superscript two shows up as an underscore
character.
I use Office 2001. In Word I can replace all the underscores with a two and
then select the two and superscript it with the following macro assigned to
a keystroke:
Sub newmacro()
Selection.Font.Superscript = True
End Sub
I don't know very much VBA so I'm sure there is probably an easier way to do
this, but this works for me.
I would like to do something similar in Excel, but when I use that macro it
superscripts the entire cell. I have tried recording a macro directly in
Excel to do this too, and then manually tweaking it so it will work in any
cell.
This is the best I have been able to do:
Sub newmacro()
ActiveCell.Characters(Start:=3, Length:=1).Caption = "2"
ActiveCell.Characters(Start:=3, Length:=0).Font.Superscript = True
ActiveCell.Characters(Start:=4, Length:=0).Font.Superscript = False
End Sub
but the only problem is that it only works when the abbreviation is the
first text in any cell. If it is the second or third word, etc. this doesn't
work.
Is there any way to select the one character I want to change and then run a
macro to make it a superscript two?
Anyone have any ideas?
letters and a superscript "2". Usually when they type this abbreviation in
their own documents they use that special character that appears to be a
superscript 2 but is not a 2 superscripted, if you follow that.
When they send me documents, the superscript two shows up as an underscore
character.
I use Office 2001. In Word I can replace all the underscores with a two and
then select the two and superscript it with the following macro assigned to
a keystroke:
Sub newmacro()
Selection.Font.Superscript = True
End Sub
I don't know very much VBA so I'm sure there is probably an easier way to do
this, but this works for me.
I would like to do something similar in Excel, but when I use that macro it
superscripts the entire cell. I have tried recording a macro directly in
Excel to do this too, and then manually tweaking it so it will work in any
cell.
This is the best I have been able to do:
Sub newmacro()
ActiveCell.Characters(Start:=3, Length:=1).Caption = "2"
ActiveCell.Characters(Start:=3, Length:=0).Font.Superscript = True
ActiveCell.Characters(Start:=4, Length:=0).Font.Superscript = False
End Sub
but the only problem is that it only works when the abbreviation is the
first text in any cell. If it is the second or third word, etc. this doesn't
work.
Is there any way to select the one character I want to change and then run a
macro to make it a superscript two?
Anyone have any ideas?