Is a simple macro possible for this useful idea (Excel 2000)?

I

itsme

Need a shortcut-key combo that does the following while Editing a character
in ANY particular cell: to CHANGE THAT HIGHLIGHTED character or characters to
Superscript.Thus, with only a simple shortcut-key, I'd more easily make the
'squared' or 'cubed' characters (a 2 and/or 3), RATHER THAN BE Forced to
repeatedly Hunt around the formatting menus repeatedly. Please note, I
unsuccessfully tried to create this by using the MacroRecorder, but that
created a 'hard-wired' code that only applied to the text in a particular
cell and Copied THAT SAME CELL'S contents to the new cell that I was trying
to modify in the first place!? So it did Not work as expected. I tried
Relative recording also, to no avail. Thanx! Thanx!
 
A

AlfD

Hi!

Something like this:

Sub Macro1()
n = Len(Trim(ActiveCell.Value))
With ActiveCell.Characters(Start:=n, Length:=1).Font
.Superscript = True
End With
End Sub

This takes the last character of a string (not a number) and makes i
into a superscript.

It is only a text / display thing: it doesn't alter values.

Al
 
G

Gord Dibben

You cannot run a macro while you are in Edit Mode, so you can only create a
macro to Superscript a fixed letter as AlfD has posted.

John Walkenbach has an Add-in that does the job nicely.

FREE download from.......

http://www.j-walk.com/ss/excel/files/supersub.htm

Another option is to Custom Format the cells.

Format>Cells>Custom

Enter ###0 then hit ALT + 0178 from the NumPad to get a Superscript 2

ALT + 0179 will produce a SS 3

Gord Dibben Excel MVP
 
Top