User form question

G

Gareth

I have a form, on it there are several Yes/No combo boxes.

If the user chooses No then I want another form to open with a comments box.
When this form is closed I would like the original form to be displayed and
the text entered into the comments box placed on a worksheet.

What would be the code for the combo box and the OK button on the second
form?

Thanks in advance.

Gareth
 
J

John Wilson

Gareth,

' Assuming the second UserForm is named UserForm2.....
Private Sub ComboBox1_Change()
UserForm2.Show
End Sub

' Assuming UserForm2 has a TextBox where you'll enter comments and
a CommandButton

Private Sub CommandButton1_Click()
Worksheets("yoursheetname").Range("A1").Value =TextBox1.Value
End Sub

If the text that's entered onto the worksheet needs to populate a textbox
or a label on UserForm1, then try
Private Sub CommandButton1_Click()
Worksheets("yoursheetname").Range("A1").Value =TextBox1.Value
Unload UserForm2
Unload UserForm1
UserForm1.Show
End Sub

John
 

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

Top