View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_19_] Patrick Molloy[_19_] is offline
external usenet poster
 
Posts: 1
Default Special string formatting

I don't think that you can format a cell to show
super/sub scripted characters. However, you can edit the
text to do thiis, but you'll lose the formula.
Here's a test example which should show how



Sub test()

Range("B2").Value = "2,45M3"

showcubed Range("B2")

End Sub
Function showcubed(ByRef target As Range)
'
'sets the last character to superscript
'
Dim length As Long
length = Len(target.Value)

With target.Characters(Start:=length, length:=1).Font
.Superscript = True
End With

End Function


Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Am using a excel report generator which works with excel

template file.
Have a cell in the template file which is referred to

as Grid_Value.
This cell is populated with a string representing cubic

meters of
water i.e
203.34M3
How can the field be formatted in vba to show 203.34 M

(superscript)3


---
Message posted from http://www.ExcelForum.com/

.