Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Larry Sartoris
 
Posts: n/a
Default buttons and boxes in userform

Hi,

I was wondering if there was a way to automatically change to a different
text box after entering only one number. I know if you have multiple text
boxes then you can enter info and then hit tab to switch to the next box.
What I want to do is only enter one number into a text box and then have it
move on to the next box.

Thanks so much for any help.

Larry
  #2   Report Post  
Posted to microsoft.public.excel.misc
Anita
 
Posts: n/a
Default buttons and boxes in userform

Hi Larry,

Try something like this:

Private Sub TextBox1_Change()
TextBox2.SetFocus
End Sub

For any change to the text in textbox1, textbox2 gets the focus.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Larry Sartoris
 
Posts: n/a
Default buttons and boxes in userform

Thanks so much for your reply and help. I just have one more question. That
worked beautifully, but what if I wanted to enter 2 numbers into the textbox?

Thanks so much!

"Anita" wrote:

Hi Larry,

Try something like this:

Private Sub TextBox1_Change()
TextBox2.SetFocus
End Sub

For any change to the text in textbox1, textbox2 gets the focus.


  #4   Report Post  
Posted to microsoft.public.excel.misc
Anita
 
Posts: n/a
Default buttons and boxes in userform

You can trigger it to switch after whatever number of numbers have been
typed in, for example:

Private Sub TextBox1_Change()
If Me.TextBox1.TextLength = 1 Then Exit Sub
If Me.TextBox1.TextLength = 2 Then Me.TextBox2.SetFocus
End Sub

Will switch after two numbers have been typed in. You can use this
logic to set it to whatever number you want by setting the TextLength =
?

Anita

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stop radio buttons moving left after Printing KoLM#s Excel Discussion (Misc queries) 5 July 19th 07 03:42 PM
Add buttons in a form from a datasource justagirl Excel Discussion (Misc queries) 0 August 3rd 05 06:05 PM
Option Buttons Grant90 Excel Discussion (Misc queries) 1 July 29th 05 02:34 PM
Option Buttons - groups Ciara Excel Discussion (Misc queries) 4 May 18th 05 05:41 PM
Option Buttons in Group Box JAMES T. Excel Discussion (Misc queries) 4 March 22nd 05 08:59 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"