textbox values to uppercase

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,069
Hi all,

Can anyone help.

I would like a vba script that changes the textbox1 value in userform1 to uppercase upon clicking on commanbutton1 (without having to enter the textbox value into a sheet).

I tried the Application.AutoCorrect but it just changed the value to True.

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Code:
[/FONT]
[FONT=Courier New]Option Explicit
Private Sub CommandButton1_Click()
Me.TextBox1.Value = UCase(Me.TextBox1.Value)
End Sub
 
Upvote 0
That's great Pedie,

Can it be incorporated into the following so that any textbox tags that have an x it will change them to uppercase.


Code:
For Each Ctrl In Me.Controls
        If Ctrl.Tag = "x" Then
            Select Case TypeName(Ctrl)
                Case "TextBox": Ctrl.Value = ""
                Case "ComboBox": Ctrl.ListIndex = -1
            End Select
        End If
    Next Ctrl
 
Upvote 0
Try this
Code:
[/FONT]
[FONT=Courier New]Private Sub CommandButton1_Click()
Dim Ctrl As Control
For Each Ctrl In Me.Controls
        If Ctrl.Tag = "x" Then
         Ctrl.Value = UCase(Ctrl.Value)
        End If
    Next Ctrl
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top