Getting subscripts and superscripts into chart legends and axis labels

profray

New Member
Joined
Sep 28, 2010
Messages
18
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
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

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
Back
Top