Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
SteveH
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

Greetings, All!

Is there code I can use with the TEXT function to apply Subscript or
Superscript formatting?

TIA

Steve H


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

Nope.

In fact, any cell that contains a formula can't use that character by character
formatting.

SteveH wrote:

Greetings, All!

Is there code I can use with the TEXT function to apply Subscript or
Superscript formatting?

TIA

Steve H


--

Dave Peterson
  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

Steve

No, not with the TEXT Function.

You would have to use some VBA code to achieve this.

What are your needs. Perhaps there is another way to do what you want.


Gord Dibben Excel MVP

On Mon, 24 Oct 2005 08:11:19 -0400, "SteveH" wrote:

Greetings, All!

Is there code I can use with the TEXT function to apply Subscript or
Superscript formatting?

TIA

Steve H


  #4   Report Post  
SteveH
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

Gord,

I know I can use

With Selection.Font
.Subscript = True
in VBA

But what I wanted to do was reference the value of i in another cell so the
cell of interest would read Xi where i would be in subscript and then copy
the formula to other locations. I was hoping there was an undocumented
parameter for the function TEXT that would allow this. If you have any
suggestions I would be glad to them

Thanks

Steve

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Steve

No, not with the TEXT Function.

You would have to use some VBA code to achieve this.

What are your needs. Perhaps there is another way to do what you want.


Gord Dibben Excel MVP

On Mon, 24 Oct 2005 08:11:19 -0400, "SteveH" wrote:

Greetings, All!

Is there code I can use with the TEXT function to apply Subscript or
Superscript formatting?

TIA

Steve H




  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

SteveH wrote...
I know I can use

With Selection.Font
.Subscript = True
in VBA


A *portion* of text within the contents of a text constant stored in a
cell can never be Selection. Using Selection in this way, you change
the entire cell's display text to subscript.

But what I wanted to do was reference the value of i in another cell so the
cell of interest would read Xi where i would be in subscript and then copy
the formula to other locations. I was hoping there was an undocumented
parameter for the function TEXT that would allow this. If you have any
suggestions I would be glad to them


The worksheet TEXT function can *ONLY* change number formatting. It
can't change any font properties. There are no hidden codes.

What you want to do can be done with the .Characters collection of the
cell's text. Somehting like


Sub foo()
Dim x As Range, y As Range, z As Range

'modify next 3 statements as needed
Set x = Range("A1")
Set y = Range("B1")
Set z = Range("C1")

z.Characters.Text = x.Text & y.Text
z.Characters(Len(x.Text) + 1, Len(y.Text)).Font.Subscript = True
End Sub



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default Subscript and Superscript with the TEXT function

Steve

The closest I can come is this macro for selected cells.

I assume the X is any string length, but I don't know how to get that string
length for each cell to set the value at Start:=2 as a variable.

Perhaps one of the real experts will jump in and modify for us.

Sub Add_Text_SubScript()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo justformulas
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = Range("B1").Value
For Each Cell In thisrng
Cell.Value = Cell.Value & moretext
With Cell.Characters(Start:=2).Font
.Subscript = True
End With
Next
Exit Sub
justformulas:
MsgBox "only formulas in range"
End Sub


Gord

On Mon, 24 Oct 2005 12:38:34 -0400, "SteveH" wrote:

Gord,

I know I can use

With Selection.Font
.Subscript = True
in VBA

But what I wanted to do was reference the value of i in another cell so the
cell of interest would read Xi where i would be in subscript and then copy
the formula to other locations. I was hoping there was an undocumented
parameter for the function TEXT that would allow this. If you have any
suggestions I would be glad to them

Thanks

Steve

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Steve

No, not with the TEXT Function.

You would have to use some VBA code to achieve this.

What are your needs. Perhaps there is another way to do what you want.


Gord Dibben Excel MVP

On Mon, 24 Oct 2005 08:11:19 -0400, "SteveH" wrote:

Greetings, All!

Is there code I can use with the TEXT function to apply Subscript or
Superscript formatting?

TIA

Steve H




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
subscript and superscript buttonsfor Excel 2003? camestres Excel Discussion (Misc queries) 1 August 24th 05 01:50 PM
Superscript Button and Subscript Button Sloth Excel Discussion (Misc queries) 2 August 12th 05 01:58 AM
Subscript & Superscript Karen Excel Discussion (Misc queries) 6 February 22nd 05 10:16 PM
Multiple font styles (superscript and subscript, for example) Lorraine Charts and Charting in Excel 0 January 13th 05 07:45 PM
What happened to Subscript and Superscript Buttons in Excel? Patrick Charts and Charting in Excel 0 January 12th 05 04:33 PM


All times are GMT +1. The time now is 08:18 PM.

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

About Us

"It's about Microsoft Excel"