Command button on forms

E

Erik (AP Inc.)

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
 
J

Jon Peltier

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
 
E

Erik (AP Inc.)

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
 
Top