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