Formatting a text string created in Excel to include subscripts
Posted on 2011-03-03
Some values generated with VBA code are used in a spreadsheet to produce a text string that is then used on a graph of the code's output as a data label marker
The text string is ="P"&TEXT(N15*100,"##")&"=$"&TEXT(N16,"#0.0")&"M" where the contents of the cells N15 and N16 are part of the code output
I want the two digits following the letter P to be subscripts to the P
Can I achieve this with formatting in Excel or can I create the same string in VBA with the subscript formatting so I could just write it to the label cell in the spreadsheet?
I know I can do it manually for static data but this has to be linked to the output of the code and update automatically