Create Superscript and Subscript Macros @Exceltrainingvideos
Create Superscript and Subscript Macros  @Exceltrainingvideos
Uploaded December 2021 | Updated September 2026, 2 weeks ago
How to create Superscript and Subscript Macros to format Excel worksheet data.
Here's the complete VBA code:
Option Explicit
Dim intBegin As Integer
Dim intLen As Integer


Private Sub cmdClearData_Click()
TextBox1.Text = ""
End Sub

Private Sub cmdGetDataFromSheet_Click()
TextBox1.Text = ActiveCell.Text
End Sub

Private Sub cmdNormal_Click()
intLen = TextBox1.SelLength

If intLen Greater Than 0 Then
intBegin = TextBox1.SelStart + 1
ActiveCell.Characters(intBegin, intLen).Font.Subscript = False
ActiveCell.Characters(intBegin, intLen).Font.Superscript = False
End If
End Sub

Private Sub cmdSubScript_Click()
intLen = TextBox1.SelLength

If intLen Greater Than 0 Then
intBegin = TextBox1.SelStart + 1
ActiveCell.Characters(intBegin, intLen).Font.Subscript = True
End If

End Sub

Private Sub cmdSuperScript_Click()
intLen = TextBox1.SelLength

If intLen Greater Than 0 Then
intBegin = TextBox1.SelStart + 1
ActiveCell.Characters(intBegin, intLen).Font.Superscript = True
'ActiveCell.Characters(intBegin, intLen).Font.Superscript = True

End If

End Sub

Private Sub cmdUnload_Click()
Unload UserForm1
End Sub

NOTE: Please replace 'Greater Than' with angular bracket.
Get more details here: exceltrainingvideos.com/create-superscript-and-subscript-macros
Create Superscript and Subscript MacrosAdding Month Sheets to Workbook Automatically | 2021User Defined FunctionsTranslation in Excel Without VBACheck Date Entry in TextBox on UserFormUsing TRIM Function in VBACustom Data Types in Excel 365Custom Function to Check Time EntriesCopy Paste Filtered Data to Another WorkbookCreate UserForm with Web Browser FunctionalityOpen UserForm in Another Workbook || 2021Two Methods to Loop through Worksheets
Dinesh Kumar Takyar |

Create Superscript and Subscript Macros

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER