ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Command button on forms (https://www.excelbanter.com/excel-discussion-misc-queries/107079-command-button-forms.html)

Erik (AP Inc.)

Command button on forms
 
I have a Visual Basic Form in my Excel File and I want to have a Enter Button
and a Quit Button on the form, so the info dosen't enter the speadsheet till
I hit the button. and then i want the form to close. And I want the quit
button to close out without entering anything. Any suggestions?

Thanks

Jon Peltier

Command button on forms
 
Have the Quit button just hide or unload the form in its event code:

Private Sub btnQuit_Click()
Unload Me
End Sub

but have the Enter button transfer the data:

Private Sub btnEnter_Click()
ActiveSheet.Range("A1").Value = Me.txtData.Value
Unload Me
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Erik (AP Inc.)" wrote in message
...
I have a Visual Basic Form in my Excel File and I want to have a Enter
Button
and a Quit Button on the form, so the info dosen't enter the speadsheet
till
I hit the button. and then i want the form to close. And I want the quit
button to close out without entering anything. Any suggestions?

Thanks




Erik (AP Inc.)

Command button on forms
 
Thanks, i got the quit button to work, still need help on the enter button. I
have the form cells linked to my excel sheet, the forms enters into the same
spot each time. Currently as soon as you enter someting into the form, it
enters into the sheet. I want it to wait till the user hits enter, to enter
it, or quit to canel and not enter anything. Currently, when i quit, the data
is still entered, and the form just closes. any help will be appreciated.

Thanks

Erik

"Jon Peltier" wrote:

Have the Quit button just hide or unload the form in its event code:

Private Sub btnQuit_Click()
Unload Me
End Sub

but have the Enter button transfer the data:

Private Sub btnEnter_Click()
ActiveSheet.Range("A1").Value = Me.txtData.Value
Unload Me
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Erik (AP Inc.)" wrote in message
...
I have a Visual Basic Form in my Excel File and I want to have a Enter
Button
and a Quit Button on the form, so the info dosen't enter the speadsheet
till
I hit the button. and then i want the form to close. And I want the quit
button to close out without entering anything. Any suggestions?

Thanks






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

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