close

How can I make the last two digits in a cell automatically change to
superscript and underline? I want to be able to enter 4 or 5 numbers
and have the last two change automatically in certain cells only.
I have a question for you ...
What is it for you that triggers the automatic change ?
or What is the unique identifier of these cells where you would like
the change to be automatic ?

Carim--
Carim
------------------------------------------------------------------------
Carim's Profile: www.excelforum.com/member.php...oamp;userid=33259
View this thread: www.excelforum.com/showthread...hreadid=531254First, this kind of formatting doesn't work with formulas or numbers--but it
will work if you treat your numbers as text (prefix the entry with an apostrophe
(') or preformat the cell as text.

So if you want to use this cell in further calculations, I wouldn't do this.
(It looks kind of like you're writing a check???)

And the underscore doesn't move directly under the superscripted
characters--it's still at the bottom of the cell.

But if you still want...

rightclick on the worksheet tab that should have this behavior. Select view
code. Paste this into the code window that just opened up.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

With Target

If .Cells.Count gt; 1 Then Exit Sub
If Intersect(.Cells, Me.Range(quot;c:cquot;)) Is Nothing Then Exit Sub
If Application.IsNumber(.Value) Then Exit Sub

If IsNumeric(.Value) Then
With .Characters(Start:=Len(.Value) - 1, Length:=2).Font
.Superscript = True
.Underline = xlUnderlineStyleSingle
End With
End If
End With

End Sub

This code looks for changes in column C (modify to what you want). And delete
that quot;.underline = ...quot; line?????

You could even enter the values as numbers and have the code convert it to text.

L Scholes wrote:
gt;
gt; How can I make the last two digits in a cell automatically change to
gt; superscript and underline? I want to be able to enter 4 or 5 numbers
gt; and have the last two change automatically in certain cells only.

--

Dave Peterson

I am a traffic accident investigator and I am using excel to transcribe
handwritten measurements for legible printing. The format used is to
write the feet in normal script and the inches in underlined
superscript. Nothing happens with these numbers except for printing.
(Sometimes I have thousands of measurements to transcribe, so a macro
will make entering them much easier.) I have tried your code, but it
doesn't seem to work. The cells, quot;C560quot; are merged (i.e., C5,C6 is
one, D5,D6 is another, etc.) in both columns. Should I unmerge the
cells, or is there a way to make this work? Thanks for all the help.
BTW, it doesn't matter how the cell is formated, text or numbers, it's
the appearance that matters. Thanks for all of your help!
Hi,

YES ... forget about merged cells they are a real nuisance when it
comes to programming ...
Then have a go with Dave's recommendation ... Given his level of
expertise, I would be surprised if you had any problems with his code.

Cheers
Carim--
Carim
------------------------------------------------------------------------
Carim's Profile: www.excelforum.com/member.php...oamp;userid=33259
View this thread: www.excelforum.com/showthread...hreadid=531254His works perfectly without merged cells! Thanks for your help!

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()