Easy one- Comman button close

  • Thread starter Thread starter David
  • Start date Start date
D

David

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
 
Hi David

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

--
XL2002
Regards

William

(e-mail address removed)

| 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
 
Add one line:

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top