#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Auto Correction

Hi...
Can I format a cell, so that when I enter for example: "120 mm2", the "2" is
converted automatically to superscript.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Auto Correction

Hi

Format the cell with a custom format
FormatCellsNumberCustom #0.0 "mmAlt0178"

Holding down the Alt button, whilst typing 0178 on the Numeric keypad,
will create the superscript 2 as soon as you release the Alt key and it
should appear as mm²

Change the number format #0.0 to suit the precision you wish to display.
This method has the advantage that any numbers entered to the cells can
still be used in further calculations.


--
Regards

Roger Govier


"Hi_no_Tori" wrote in message
...
Hi...
Can I format a cell, so that when I enter for example: "120 mm2", the
"2" is
converted automatically to superscript.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Auto Correction

You can do that with this event sub:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Characters(Start:=InStr(1, Target, "mm2") + 2,
Length:=1).Font.Superscript = True
End Sub

You can refine the sub if you want to apply it only to a certain range, e.g.
column A:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then Target.Characters(Start:=InStr(1, Target,
"mm2") + 2, Length:=1).Font.Superscript = True
End Sub

Regards,
Stefi


€˛Hi_no_Tori€¯ ezt Ć*rta:

Hi...
Can I format a cell, so that when I enter for example: "120 mm2", the "2" is
converted automatically to superscript.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Auto Correction

Hi Stefi
I tried the code you have given me. It's working, so than you SO MUCH for
your help.

I have another related question, and I'll be really thankful if you can
help. How can I refine the sub to make it apply to only a single cell (e.g.
D12)?

Many thanks again. (^_^)
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Auto Correction

Hi Roger...

Thanks for respnding quickly to my question. I tried your method, but it
didn't work. Please, check the method you have given to me, to see whether
it's working properly or not.

THANK YOU


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Auto Correction

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "D12" Then
Target.Characters(Start:=InStr(1, ActiveCell, "mm2") + 2,
Length:=1).Font.Superscript = True
End Sub

Regards,
Stefi


"Hi_no_Tori" wrote:

Hi Stefi
I tried the code you have given me. It's working, so than you SO MUCH for
your help.

I have another related question, and I'll be really thankful if you can
help. How can I refine the sub to make it apply to only a single cell (e.g.
D12)?

Many thanks again. (^_^)

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Auto Correction

Hi

Tried it out before sending, and it worked perfectly.
Are you using the numeric keypad to enter 0178 whilst holding down the
Alt key?
It will not work if you use the numbers on the top row of your keyboard.

If you are using a laptop computer without a numeric pad, there is
usually a function button plus a key which will invoke a "pseudo"
numeric pad using the
789
UIO
JKL
M
keys on the keyboard.

Try switching on the "pseudo" numeric keyboard after typing the "mm and
before you type the Alt+0178

--
Regards

Roger Govier


"Hi_no_Tori" wrote in message
...
Hi Roger...

Thanks for respnding quickly to my question. I tried your method, but
it
didn't work. Please, check the method you have given to me, to see
whether
it's working properly or not.

THANK YOU



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Auto Correction

Hi...

It didn't work at first. When I enter for example "120 mm2", the "2" in 120
becomes superscript instead of the "2" in "mm2". I replaced "ActiveCell"
with "Target" and now it's working properly. the problem is solved. Thank you
VERY MUCH, Stefi. (^_^)

Regards,
Hi_no_Tori

"Stefi" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "D12" Then
Target.Characters(Start:=InStr(1, ActiveCell, "mm2") + 2,
Length:=1).Font.Superscript = True
End Sub

Regards,
Stefi



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Auto Correction

Hi Roger

I'm not sure whether you have understood my need or not. I'll try to
clarify... Here is what I wanted to do again:

When I type for example "120 mm2" in a cell (e.g. D12) and press enter, I
want the font of the "2" in "mm2" to be converted automatically to
superscript.

I tried formatting the cell D12 as you have told me:
FormatCellsNumberCustom #0.0 "mmAlt0178"

but it didn't work... When I type "120 mm2" and press enter, it remains just
the same.

regards,
Hi_no_Tori

"Roger Govier" wrote:

Hi

Tried it out before sending, and it worked perfectly.
Are you using the numeric keypad to enter 0178 whilst holding down the
Alt key?
It will not work if you use the numbers on the top row of your keyboard.

If you are using a laptop computer without a numeric pad, there is
usually a function button plus a key which will invoke a "pseudo"
numeric pad using the
789
UIO
JKL
M
keys on the keyboard.

Try switching on the "pseudo" numeric keyboard after typing the "mm and
before you type the Alt+0178

--
Regards

Roger Govier


  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Auto Correction

Hi

I now see the problem, I should have been more explicit.
Having formatted the cell as described, all you need to enter is 120.
What will be displayed (because of the formatting) will be 120 mm²
As I said originally, the advantage of this method is that the number
(120) can be utilised in any further calculation, as it is still purely
a number.
--
Regards

Roger Govier


"Hi_no_Tori" wrote in message
...
Hi Roger

I'm not sure whether you have understood my need or not. I'll try to
clarify... Here is what I wanted to do again:

When I type for example "120 mm2" in a cell (e.g. D12) and press
enter, I
want the font of the "2" in "mm2" to be converted automatically to
superscript.

I tried formatting the cell D12 as you have told me:
FormatCellsNumberCustom #0.0 "mmAlt0178"

but it didn't work... When I type "120 mm2" and press enter, it
remains just
the same.

regards,
Hi_no_Tori

"Roger Govier" wrote:

Hi

Tried it out before sending, and it worked perfectly.
Are you using the numeric keypad to enter 0178 whilst holding down
the
Alt key?
It will not work if you use the numbers on the top row of your
keyboard.

If you are using a laptop computer without a numeric pad, there is
usually a function button plus a key which will invoke a "pseudo"
numeric pad using the
789
UIO
JKL
M
keys on the keyboard.

Try switching on the "pseudo" numeric keyboard after typing the "mm
and
before you type the Alt+0178

--
Regards

Roger Govier




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
Auto Correction david.salazar Excel Discussion (Misc queries) 1 July 19th 06 05:24 PM
Is there a way to link Auto Filter values to a Cell SteveC Excel Worksheet Functions 2 May 1st 06 07:47 PM
Macro for Auto Fill carolini Excel Discussion (Misc queries) 2 December 6th 05 09:11 PM
excel links update not working in auto, calculations in auto Mikey Boy Excel Worksheet Functions 0 December 7th 04 11:53 PM
Why can't my macro use Auto Filter when I told the Sheet Protecti. KC Rippstein Excel Worksheet Functions 1 October 28th 04 06:13 PM


All times are GMT +1. The time now is 03:34 PM.

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"