ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy one- Comman button close (https://www.excelbanter.com/excel-programming/300346-easy-one-comman-button-close.html)

David

Easy one- Comman button close
 
What is the code to get a command button to populate a
field and then close the form when the user clicks the
button once?

So far the code I have is:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C4").Value = TextBox1.Text

End Sub

What am I missing please?

Thanks,
David

William[_2_]

Easy one- Comman button close
 
Hi David

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C4").Value = TextBox1.Text
Unload Me
End Sub

--
XL2002
Regards

William



"David" wrote in message
...
| What is the code to get a command button to populate a
| field and then close the form when the user clicks the
| button once?
|
| So far the code I have is:
|
| Private Sub CommandButton1_Click()
| Worksheets("Sheet1").Range("C4").Value = TextBox1.Text
|
| End Sub
|
| What am I missing please?
|
| Thanks,
| David



kkknie[_135_]

Easy one- Comman button close
 
Add one line:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C4").Value = TextBox1.Text
Unload Me
End Sub



--
Message posted from http://www.ExcelForum.com


Ron de Bruin

Easy one- Comman button close
 
Hi David

Worksheets("Sheet1").Range("C4").Value = TextBox1.Text
Unload Me


--
Regards Ron de Bruin
http://www.rondebruin.nl


"David" wrote in message ...
What is the code to get a command button to populate a
field and then close the form when the user clicks the
button once?

So far the code I have is:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C4").Value = TextBox1.Text

End Sub

What am I missing please?

Thanks,
David





All times are GMT +1. The time now is 02:22 AM.

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