ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Textbox (https://www.excelbanter.com/excel-programming/409869-textbox.html)

ranswrt

Textbox
 
How do I get a curser to move to a textbox in a userform when a button is
clicked?
Thanks

JLGWhiz

Textbox
 
I created a UserForm with three text boxes. Then I used the initialize event
to put the cursor in TextBox3, I used double click events in TextBox 3 and 2
to move the cursor to TextBoxes 2 and 1 respectively. Then a double click
event in TextBox1 to close the UserForm. Here is the code behind the
UserForm:

Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Unload Me
End Sub

Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.SetFocus
End Sub

Private Sub TextBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TextBox2.SetFocus
End Sub

Private Sub UserForm_Initialize()
Me.TextBox3.SetFocus
End Sub

Of course, the UserForm1.Show command is issued from the standard code module.


"ranswrt" wrote:

How do I get a curser to move to a textbox in a userform when a button is
clicked?
Thanks



All times are GMT +1. The time now is 01:16 PM.

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