ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close form when I press enter (https://www.excelbanter.com/excel-programming/420399-close-form-when-i-press-enter.html)

Michelle

Close form when I press enter
 
I have a user-form with a 2-column combo box, and the combo-box opens as
soon as the form is displayed using:

Private Sub UserForm_Activate()
ddCodes.SetFocus
SendKeys ("{F4}")
End Sub

When I select an entry (or type the first letter of an entry and press
Enter), it closes the list, and then I have to press Enter (again) to
trigger the After_Update event (which closes the form and puts the value
into the cells).

I want to only have to only have to select an entry (or type and press Enter
once) to trigger an event - I don't care which event it is - I want to make
it as easy as possible for the users to select items from the list.

However, I can't use the change event, because that is triggered each time a
single character is typed, and sometimes users have to type multiple
characters into the box. Is there a way around this?

Appreciate your help - thanks

Michelle


JP[_4_]

Close form when I press enter
 
Have you tried the BeforeUpdate Event?

--JP


On Nov 22, 8:29 am, "Michelle" wrote:
I have a user-form with a 2-column combo box, and the combo-box opens as
soon as the form is displayed using:

Private Sub UserForm_Activate()
ddCodes.SetFocus
SendKeys ("{F4}")
End Sub

When I select an entry (or type the first letter of an entry and press
Enter), it closes the list, and then I have to press Enter (again) to
trigger the After_Update event (which closes the form and puts the value
into the cells).

I want to only have to only have to select an entry (or type and press Enter
once) to trigger an event - I don't care which event it is - I want to make
it as easy as possible for the users to select items from the list.

However, I can't use the change event, because that is triggered each time a
single character is typed, and sometimes users have to type multiple
characters into the box. Is there a way around this?

Appreciate your help - thanks

Michelle




All times are GMT +1. The time now is 04:58 PM.

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