Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My original question was...What is the code to enter lets
say TextBox6. When I say this, I want the cursor to enter that textbox. Robin Hammond said to use setfocus textbox6.setfocus When I do this it does not work. The way I did it was entering a value in textbox6 and clicking in another textbox, if a certain condition is met a msgbox pops up telling the user invalid value and then the next line is textbox6.setfocus to bring the cursor back in that textbox, but instead, the cursor goes to the textbox I clicked. How do I fix this? Thank you Todd Huttenstine |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Todd,
This works for me With TextBox6 .SetFocus .SelStart 1 .SelLength = Len(.Text) Cancel = True End With I use this code in the Textbox Exit event, as this has the option to cancel an exit. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Todd Huttenstine" wrote in message ... My original question was...What is the code to enter lets say TextBox6. When I say this, I want the cursor to enter that textbox. Robin Hammond said to use setfocus textbox6.setfocus When I do this it does not work. The way I did it was entering a value in textbox6 and clicking in another textbox, if a certain condition is met a msgbox pops up telling the user invalid value and then the next line is textbox6.setfocus to bring the cursor back in that textbox, but instead, the cursor goes to the textbox I clicked. How do I fix this? Thank you Todd Huttenstine |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you that did it.
-----Original Message----- Todd, This works for me With TextBox6 .SetFocus .SelStart 1 .SelLength = Len(.Text) Cancel = True End With I use this code in the Textbox Exit event, as this has the option to cancel an exit. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Todd Huttenstine" wrote in message ... My original question was...What is the code to enter lets say TextBox6. When I say this, I want the cursor to enter that textbox. Robin Hammond said to use setfocus textbox6.setfocus When I do this it does not work. The way I did it was entering a value in textbox6 and clicking in another textbox, if a certain condition is met a msgbox pops up telling the user invalid value and then the next line is textbox6.setfocus to bring the cursor back in that textbox, but instead, the cursor goes to the textbox I clicked. How do I fix this? Thank you Todd Huttenstine . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SetFocus using variable name | Excel Programming | |||
SetFocus Problems | Excel Programming | |||
TextBox SetFocus Problem | Excel Programming | |||
SetFocus problem | Excel Programming | |||
TextBox.SetFocus | Excel Programming |