Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Default commandbutton
Hi,
I have userform with few textboxes and few commandbuttons. my question is how to make that after i will finish entering data to one of the textboxs and click Enter specific commandbutton will be executed. Thanks in advance Eli |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Default commandbutton
I have userform with few textboxes and few commandbuttons. my question is
how to make that after i will finish entering data to one of the textboxs and click Enter specific commandbutton will be executed. Set the Default property to True for the CommandButton whose Click event code you want to execute whenever the Enter key is pressed. If you need to know which control had focus when the Enter key was pressed, set up a form-wide global variable in the form window's (General)(Declarations) section and Set this variable to the control object in each control's Enter event. Maybe something like this, as a starting framework, for example... Dim LastControl As Control Private Sub CommandButton1_Click() Debug.Print LastControl.Name End Sub Private Sub TextBox1_Enter() Set LastControl = TextBox1 End Sub Private Sub TextBox2_Enter() Set LastControl = TextBox2 End Sub Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
commandbutton? | Excel Programming | |||
Commandbutton | Excel Programming | |||
CommandButton | Excel Programming | |||
CommandButton | Excel Programming | |||
CommandButton | Excel Programming |