Getting subscripts and superscripts into chart legends and axis labels

profray

New Member
Joined
Sep 28, 2010
Messages
15
Yes it is a pain. I know Peltier had a post on it, but I could not find it, so here is what I did: 1. Write a very simple VBA function as shown below
Code:
Function CharRet(RowVal As Integer, ColVal As Integer) As String
WCode = CLng(RowVal + ColVal)
CharRet = ChrW(WCode)
End Function
The row value and column values are just numbers to bring into the function so you can construct a simple table. The function returns a string of one character. The key function here is ChrW which gets the Unicode symbol corresponding to the long integer value you send it. 2. Build a worksheet with first column with cell values 00 to 99 and top row columns as values 0, 100, 200,... to 5000 3. Insert the CharRet function and have it get the row and column numbers to be the input values to the function. 4. Observe the cells to figure out which (decimal) number is the right Unicode value for the symbol I wanted. 5. I actually did two sets, 0 to 5000 and 5100 to 10000 to find everything I needed. 6. Copy the needed symbol from the cell and Paste Special (Value) into the destination cell for use as a legend label. You can paste in more special characters as you go, but you may need to first paste special into another cell, then paste everything together. 7. Use the recently built-up cell as the label cell for the legend. Since the symbols may vary for different fonts, you may want to copy the worksheet and reset the font for the new worksheet to match another font set. Axis labels can be pasted in straight from the chart. Again, copy the symbol from an intermediate cell and paste it into your axis label text at the right spot. Hope this helps some of you
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Watch MrExcel Video

Forum statistics

Threads
1,122,207
Messages
5,594,843
Members
413,944
Latest member
3xc3ln00b

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top