View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
TimT TimT is offline
external usenet poster
 
Posts: 69
Default Userform - Move to next textbox field by hitting enter instead

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

"Harald Staff" wrote:

Hi Mike

I disagree 150%. In an Excel environment, where these users are expected to
come from, Enter completes a cell entry and jumps to the next cell. The
default "Windows Form" behavior is less relevant.

No, it does not require much code, it's done within 20 seconds. For each
textbox, copypaste this and change its name in the title:

Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub

And even if it did require hours of code; do it. Developers are there to
serve users, users are not there to serve developers. Anything improving the
user experience is worth doing.

Best wishes Harald

"Mike Mertes" skrev i melding
...
Tim,

Unfortunately, I have to develop for people who aren't familiar with

windows
functions, too. (Such as using tab to switch text boxes instead of enter
like in Excel.)

Here were my two solutions:
1. When the Default property of all buttons on the userform is set to

False,
using the enter button should advance to the next text box. However, this

is
not a particularly good solution for users who do know how to use tab (or
aren't too lazy to learn it) because they'll want to use enter to activate
the default button, like choosing the "OK" button when all the necessary
data has been entered. Instead, I chose solution #2:

2. Explain to your users how to use windows and hope like crazy they're

more
responsive than a pile of bricks.

I'm sure you could also intercept any enter key presses, but isn't that

too
much coding for a simple [user] problem? Also, you'd incur the same
detriment as above (I want my default buttons, darn it! That doesn't make

me
an elitist, does it?)

Hope I helped.

-Mike

"TimT" wrote in message
...
Hey all,
As the subject states...
I'm designing many userforms for this workbook and a lot of the users

are
used to hitting enter to move to the next field. I only know of using

tab
to
move to the next one.
Is there a way to accomplish this?