Superman for superscript

darro

Board Regular
Joined
Mar 10, 2009
Messages
208
I would like to be able to add a superscript button to my toolbar along side the bold, italic and underline buttons. I know it is unavailable through the customise toolbars method so my question is this. How can I do it?

I often have to enter m3 or kgm3 or m2 etc into cells, or sometimes it is already entered into cells for me and then I need to superscript the 2 or 3. Because the character needing to be superscripted is in a different place each time, and sometimes in a string of text I am unable to use a Len type macro, what i need to be able to do is select the text I want superscripted and run my macro and hey presto, its done.

Anyone out there who can figure this one out?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I turned on the macro record and recorded the process. Then I cleaned it up a bit

How to use:
Type whatever you want in a cell, ending with the superscript value. (As presented here, it can only be 1 character in length.)
Press Enter
Re-select the cell (but don't put in edit mode) and run the macro.
(I'm assuming you know how to add a button and associate it with a macro.)

Sub SuperScrptMe()
With ActiveCell.Characters(Start:=Len(ActiveCell), Length:=1).Font
.Superscript = True
End With
End Sub
 
Upvote 0
Thanks Crunch.

Thats great, but... can it be made to allow me to superscript what I want no matter where it is the string of text? Sometimes the data I receive includes the text around what needs to be superscripted.

my ideal is something like the Bold or Italic button, I select the cell, select the character to be suped and click macro button and hey presto its done.

What do you think?
 
Upvote 0
I think the problem is that you can't run a macro while you are in "edit" mode inside a cell's contents. Isn't that true? If there is a way, I'm not aware of it, which would make any custom macro you made not executable while you were highlighting the character or characters you wanted to superscript...
 
Upvote 0
Yes that is a problem, maybe when the supe macro is run an input box opens containing the active cells text, allowing me to highlight the character/s to be suped and when I click OK it does it?

Is that possible?
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top