Make last character in cell superscript

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,968
This is an example off MS Help. This works if the last character is alpha, but fails if it is numeric.
Can this be altered to show a number w/ a superscript number?

This example makes the last character in cell A1 a superscript character.[/size]

Code:
Sub MakeSuperscript()
    Dim n As Integer

    n = Worksheets("Sheet1").Range("A1").Characters.Count
    Worksheets("Sheet1").Range("A1").Characters(n, 1) _
    .Font.Superscript = True
End Sub
 
Norie,
I was reading up on Range objects in the MS help and ran across this example. I thought it would be cool to be able to show a number w/ an exponent.
It is of curiousity and not a definite need right now. It could be cool to show the exponent in (), I wonder if that will work?
I will have to go play w/ it. If you get any ideas, feel free to shoot them my way.

thanks,

doug
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hmmmm,
I wonder what Kris got then?

Kris? What value do you have in "A1"?

Did you notice this
Code:
Worksheets("Sheet1").Range("A1").NumberFormat = "@"

line. I changed the number to Text value and applied the superscript.

HTH
 
Upvote 0
Hi Kris,
I did, and I altered my code to what you had posted. I am using the code below and even changed the cell format to Text, but still get the run-time error.
<a href="http://img80.imageshack.us/my.php?image=superscriptkw4.png" target="_blank">
superscriptkw4.th.png
</a>

Here you can see everything by clicking on this link:
http://img80.imageshack.us/my.php?image=superscriptkw4.png

Code:
Option Explicit


Sub MakeSuperscript()
    Dim n As Integer

    n = Worksheets("Sheet1").Range("A1").Characters.Count
    Worksheets("Sheet1").Range("A1").NumberFormat = "@"
    Worksheets("Sheet1").Range("A1").Characters(n, 1) _
    .Font.Superscript = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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