Forum Discussion
How to type superscript in Excel macro?
- Jun 10, 2022
Dear HansVogelaar
Thank you very much for your suggestion regarding the language. I managed to get the solution.
By changing the Language for non-Unicode Programs to English (United States) in the Control Panel, the superscript and other symbols can be written in the VBA
My default was Japanese (Japan) and even English (United Kingdom) was unsuccessful.
Here's also the link that I referred to
https://answers.microsoft.com/en-us/msoffice/forum/all/excel-2019-open-excel-2010-vba-with-strange-symbol/99fbad9d-282f-4da5-a19f-12f306363d1b
I really appreciate your help by responding to my question.
Please have a good day.
The Visual Basic Editor should be able to handle ²:
Screenshot:
Code:
Sub Test()
Dim wsh As Worksheet
Set wsh = Worksheets("px²")
End Sub
Dear HansVogelaar
Thank you for your reply. However, I still cannot insert the superscript even by pasting from your code. Please find the screenshot below.
When I tried copying the Superscript Two symbol into the VBA, the Superscript Two symbol changed to a question mark.
- HansVogelaarJun 10, 2022MVP
That's a pity - it might have to do with your language settings, but I'm afraid I don't have a solution for you, except renaming the sheets.
- taufiq6121Jun 10, 2022Copper Contributor
Dear HansVogelaar
Do you mind sharing which language your Microsoft Office is?
Sometimes I will have zero output in some of the sheets resulting in that very particular sheet not being present at all.
So I will have difficulties renaming the sheet by Sheet Index Number because the missing sheet will affect the Sheet Index Number sequence
- HansVogelaarJun 10, 2022MVP
My Office uses English (United States) as primary language.