This user-form has a text box which shows the string in a selected cell (using ActiveCell.Formula). The form then allows the fonts of each character to be manipulated by clicking buttons.
It works as intended, the font is changed within the worksheet.
Is it possible to show the font change within the TextBox of the UserForm?
Form snapshot.png
USERFORM
Private Sub UserForm_Activate()
TextBox1.Text = ActiveCell.Formula
btnExit.SetFocus
End Sub
Private Sub btn01_Click()
Dim intStart As Integer
Dim intLength As Integer
intLength = TextBox1.SelLength
If intLength > 0 Then
intStart = TextBox1.SelStart + 1
ActiveCell.Characters(intStart, intLength).Font.Name = "Arial"
End If
End Sub
Private Sub btn02_Click()
Dim intStart As Integer
Dim intLength As Integer
intLength = TextBox1.SelLength
If intLength > 0 Then
intStart = TextBox1.SelStart + 1
ActiveCell.Characters(intStart, intLength).Font.Name = "Calibri"
End If
End Sub
Private Sub btn03_Click()
Dim intStart As Integer
Dim intLength As Integer
intLength = TextBox1.SelLength
If intLength > 0 Then
intStart = TextBox1.SelStart + 1
ActiveCell.Characters(intStart, intLength).Font.Name = "Times New Roman"
End If
End Sub
Private Sub btnExit_Click()
Unload UserForm_Text_Fonts
End Sub
MODULE
Sub Text_Fonts()
UserForm_Text_Fonts.Show
End Sub
Bookmarks