ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to activate a text box (https://www.excelbanter.com/excel-programming/401166-how-activate-text-box.html)

[email protected]

How to activate a text box
 
I have a form that contains a text box and some other controls. After a
user uses one of the other controls, I would like to activate the text box
so that the user can immediately type in it without clicking it first.

Thanks for any help!

Dan R.

How to activate a text box
 
It depends on the control. For an option button:

Private Sub OptionButton1_Click()
Me.TextBox1.SetFocus
End Sub

Or for another textbox:

Private Sub TextBox1_Change()
If Len(Me.TextBox1.Text) = 4 Then
Me.TextBox2.SetFocus
End If
End Sub

--
Dan

[email protected]

How to activate a text box
 
Thanks - that works great!

On Thu, 15 Nov 2007 08:15:21 -0800 (PST), "Dan R."
wrote:

It depends on the control. For an option button:

Private Sub OptionButton1_Click()
Me.TextBox1.SetFocus
End Sub

Or for another textbox:

Private Sub TextBox1_Change()
If Len(Me.TextBox1.Text) = 4 Then
Me.TextBox2.SetFocus
End If
End Sub




All times are GMT +1. The time now is 10:39 AM.

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