Share via

How do you superscript code/text in VBA?

Anonymous
2024-04-11T16:35:25+00:00

How can I superscript the letter "i" in parenthesis of last line below to be like the 1 and 2 in the lines above (bolded for clarity)? I am not the one who wrote this macro and am trying to make updates...

Selection.Replace What:="<sup>1</sup>", Replacement:="**¹**", LookAt:=xlPart \_ 

    , SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, \_ 

    ReplaceFormat:=False 

Selection.Replace What:="<sup>2</sup>", Replacement:="**²**", LookAt:=xlPart \_ 

    , SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, \_ 

    ReplaceFormat:=False 

Selection.Replace What:="<sup>i</sup>", Replacement:="**i**", LookAt:=xlPart \_ 

    , SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, \_
Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-04-11T17:17:35+00:00

    Looks like that worked for the macro after running! Thank youX1000!

    Was this answer helpful?

    0 comments No comments
  2. HansV 462.6K Reputation points
    2024-04-11T16:58:32+00:00

    Try Replacement:=ChrW(&H2071)

    Was this answer helpful?

    0 comments No comments