At some point of time you may need user to force to Enter in a particular Case in your Excel Macro Text Box. It could be either in a Lower Case or Upper Case. Unfortunately in VBA Text Box, you don’t have any inbuilt settings to do so. However by writing few lines code under Textbox Change Event , you can achieve this.

Here in this Article you learn how to achieve all these settings in VBA Textbox.

This is possible by using 2 functions: 1. StrConv() and 2. LCase or UCase

How to force input to Upper case in VBA Textbox:

By using StrConv() function in VB


Private Sub TextBox1_Change()
TextBox1.Text = StrConv(TextBox1.Text, vbUpperCase)
End Sub

By using “UCase” function in VB


Private Sub TextBox1_Change()
TextBox1.Text = UCase(TextBox1.Text)
End Sub

How to force input to Lower case in VBA Textbox:

By using StrConv() function in VB


Private Sub TextBox1_Change()
TextBox1.Text = StrConv(TextBox1.Text, vbLowerCase)
End Sub

By using “LCase” function in VB


Private Sub TextBox1_Change()
TextBox1.Text = LCase(TextBox1.Text)
End Sub

Read This Also:

cover3d_0-89071700_1484285537__1_

Join over 10, 000+ Excel VBA Enthusiasts & get this FREE e-Book Now!