Close button on form
As a user, I'm more used to using the Escape key to do the same as the Cancel
key and the Enter key to the same as the "ok" key.
You can accomplish this in your userform_initialize procedure with code like:
With Me.CommandButton1
.Caption = "Cancel"
.Cancel = True
'.Enabled = True
End With
With Me.CommandButton2
.Caption = "Ok"
.Default = True
'.Enabled = False
End With
If you really want to close the userform by hitting enter, you can use .default
= true on that commandbutton. (only one commandbutton can have those
properties.)
Sandy wrote:
I have a form which opens when excel opens
If Sheets("SearchRoundsData").Range("B2").Value = 1 Then
frmWelcome.Hide
Else
frmWelcome.Show
End If
On the form there is a close button "CommandButton1". Is it possible to give
this button focus so that the user can use the Enter keyboard key rather
than having to click with the mouse?
Thanks
Sandy
--
Dave Peterson
|