Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
L Scholes
 
Posts: n/a
Default automatic font change

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.

  #2   Report Post  
Posted to microsoft.public.excel.misc
Carim
 
Posts: n/a
Default automatic font change


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: http://www.excelforum.com/member.php...o&userid=33259
View this thread: http://www.excelforum.com/showthread...hreadid=531254

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default automatic font change

First, 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 1 Then Exit Sub
If Intersect(.Cells, Me.Range("c:c")) 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 ".underline = ..." line?????

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

L Scholes wrote:

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.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
L Scholes
 
Posts: n/a
Default automatic font change

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, "C5:D60" 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!

  #5   Report Post  
Posted to microsoft.public.excel.misc
Carim
 
Posts: n/a
Default automatic font change


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: http://www.excelforum.com/member.php...o&userid=33259
View this thread: http://www.excelforum.com/showthread...hreadid=531254



  #6   Report Post  
Posted to microsoft.public.excel.misc
L Scholes
 
Posts: n/a
Default automatic font change

His works perfectly without merged cells! Thanks for your help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to change the default font in Excel comments? GZul Excel Discussion (Misc queries) 1 December 6th 05 12:30 AM
Event Macro adjustment needed - need to change font color also nick s Excel Worksheet Functions 2 November 28th 05 05:50 PM
how do i change the font size in a combo box? nkruppa Excel Worksheet Functions 1 August 10th 05 10:02 PM
Moving Excel Charts into Word Documents: font sizes change Sam Charts and Charting in Excel 4 June 24th 05 09:01 PM
Change datalabel font size for all chartobjects in a row Marie J-son Charts and Charting in Excel 2 December 5th 04 07:02 PM


All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"