User form Help

A

Aravind

hello everybody,
I created a user form with certain number of option buttons, text
boxes and check boxes. i was wondering how to clear these values of
these buttons after the user has submitted the data into the excel
sheet. so that new data can be entered into the text boxes and the
check box is not checked accidentally.

EXAMPLE:

name: TEXTBOX1

number: TEXTBOX2

email: TEXTBOX3

i know the a very easy way to clear the text box is to set the
textbox1.text = "" after the submit button is pressed.

Another problem is to use VBA if an option button is selected i want
one of the three text boxes to be put into the excel sheet. this
something i wrote in VBA.

StationBox, RadioBox and OtherBox are text boxes. qs75 qs74 qs73 are
Option buttons


Private Sub Submit_Click()
Dim LastRow As Object

Set LastRow = Sheet1.Range("a65536").End(xlUp)

If qs75.Value = True Then
LastRow.Offset(1, 14).Value = StationBox.Text
End If

If qs74.Value = True Then
LastRow.Offset(1, 14).Value = RadioBox.Text
End If

If qs73.Value = True Then
LastRow.Offset(1, 14).Value = OtherBox.Text
End If
 
G

Guest

i don't have answers to all of your questions, but I can answer one off the
top of my head. To clear a checkbox or radio button you do:

chkBox1.Value = False
 
M

merjet

Dim c As Control
For Each c In Controls
If TypeName(c) = "TextBox" Then
c = ""
End If
If TypeName(c) = "OptionButton" Or _
TypeName(c) = "CheckBox" Then
c.Value = False
End If
Next c

Hth,
Merjet
 

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