PDA

View Full Version : Solved: CHAR() & Superscript Property



Erdin? E. Ka
10-17-2006, 02:22 PM
Hi everyone, :hi:

I wrote a formula to write square meter and cubic meter.

=IF(A1>=1;"m"&CHAR(178);"m"&CHAR(179))


It's ok. But i tried to write a VBA subroutine with Subscript and superscript properties but i coundn't it. :dunno

(But i do not need a code which is by record macro method.)

Are there any sample for this?

Thanks a lot. :friends:

mdmackillop
10-17-2006, 02:55 PM
You can achieve this simply by adding m2 m? and m3 m? as auto corrects in Word. The only drawback is when you refer to M2 or M3 as a range in your workbook. :mkay

Bob Phillips
10-17-2006, 02:58 PM
Sub Superscript()

With ActiveCell
If .Offset(0, -1).Value > 1 Then
.Value = "m2"
Else
.Value = "m3"
End If
.Characters(2, 1).Font.Superscript = True
End With

End Sub

Erdin? E. Ka
10-17-2006, 03:35 PM
Thanks for all helps.:friends: