Create Superscript and Subscript Macros

preview_player
Показать описание
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.
Рекомендации по теме
Комментарии
Автор

Excellent 🌟🌟🌟🌟🌟, lo necesitaba. Muchas gracias por compartir

mayerjesus
Автор

Hi Mr Dinesh Kumar, hope you can help me solving my problem. I want to record max value on a live feed data. How can i do that?

Amin_BADAR
Автор

Please help me to do this I wand to highlights the list of date from multiple years date which is not fall in financial year mensed in cell b3 2019-20
List of date
1/01/21 to
Please help me to do this sir

Kumaranmoljha
welcome to shbcf.ru