ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB UserForm (https://www.excelbanter.com/excel-programming/352166-vbulletin-userform.html)

grahammal[_10_]

VB UserForm
 

If I want to change the case from lower case to upper case in the
following location I can use the following code.
Dim cell As Range
For Each cell In Range("F3").Cells
If cell.HasFormula = False Then cell = UCase(cell)
Next

How do I achieve the same result if the location is a TextBox created
in a UserForm. ie TextBox1 in UserForm1


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=507615


Peter T

VB UserForm
 

Me.TextBox1.Text = UCase(Me.TextBox1.Text)

If code is not in the form change "Me" to the form name

Note this will trigger the TextBox Change event if you are using it. If
necessary set a (global) boolean flag to True/False either side of the above
code to early exit the event and re-set to false when done.

Private Sub TextBox1_Change()
If bExit Then Exit Sub
End Sub

Regards,
Peter T


"grahammal" wrote
in message ...

If I want to change the case from lower case to upper case in the
following location I can use the following code.
Dim cell As Range
For Each cell In Range("F3").Cells
If cell.HasFormula = False Then cell = UCase(cell)
Next

How do I achieve the same result if the location is a TextBox created
in a UserForm. ie TextBox1 in UserForm1


--
grahammal
------------------------------------------------------------------------
grahammal's Profile:

http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=507615





All times are GMT +1. The time now is 09:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com