Thread: Textbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default 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