View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Userform - Move to next textbox field by hitting enter instead

i just have a question here. how come i can hit enter to move between text
boxes on my form? i don't have any code, other than to limit number entry to
a couple of fields.
the EnterKeyBehavior is set to false, which means enter moves the focus to
the next object in the tab order.

now, when i get to a frame with checkboxes, enter does nothing and tab moves
to the next checkbox.

just wondering

--


Gary


"Harald Staff" wrote in message
...
OK, ok, ok, ok. I surrender.

Replace "Userform1" wit the name of your particular form and this little
etude will generate all the necessary code for you in the immediate
window:

Sub test()
Dim C As MSForms.Control
For Each C In UserForm1.Controls
If TypeOf C Is MSForms.TextBox Then

Debug.Print "Private Sub " & C.Name & "_KeyDown(ByVal KeyCode As _"
Debug.Print "MSForms.ReturnInteger, ByVal Shift As Integer)"
Debug.Print "If KeyCode = 13 Then KeyCode = 9"
Debug.Print "End Sub"
Debug.Print ""

End If
Next
End Sub

HTH. Best wishes Harald

"TimT" skrev i melding
...
Harald,
I just realized, I know what I needed to ask you...
Is there any way that I could simply pull up a list of all the
textboxes/objects on a particular form that I am working on?

example: if I'm replacing all the "Textbox_1"'s... that's about 83 of
them
I have to do and even though I used a consistant naming convention I
can't
remember them all.

Solution?

"Harald Staff" wrote:

Glad to hear that. Thank you for the feedback.

Besst wishes Harald

"TimT" skrev i melding
...
Brilliant Harald!
Thank you so much.
You are absolutely right, it's not that bad and it makes me feel alot
better
about myself knowing I can provide what the user is looking for.

Much thanks brah.

TTeska
Tax Technology
Marcum & Kliegman LLP
Melville, NY 631.414.4594