PDA

View Full Version : Need Help With User Form



SeanMcquade
12-03-2007, 10:10 PM
I have created a form and I need it to take the inputs compute a forumula and then output it into specified excel cells.

What code takes the output back to Excel?


Private Sub CommandButton1_Click()
End Sub
Private Sub CancelButton_Click()
' closes box
Unload userform1
End Sub

Private Sub cmdClearForm_Click()

'Clears the specified textboxes and comboxes

Me.TextBox1.Value = vbNullString
Me.CheckBox1.Value = False
Me.TextBox2.Value = vbNullString
Me.ComboBox1.Value = vbNullString
Me.Option1st.Value = True


End Sub



Private Sub ClearFormButton_Click()


End Sub
Private Sub ComboBox1_Change()


End Sub

Private Sub OptionButton3_Click()
End Sub
Private Sub OKButton_Click()
End Sub
Private Sub Option2nd_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub UserForm_Click()
End Sub




I realize that a lot of the buttons do not yet have attributes, that is because I am kind of struggling with assigning the buttons the forumula I am using.


Thanks for any Help

SeanMcquade
12-03-2007, 10:13 PM
I'm sorry if this is vague but I am a very begginer and am learning as a go while working on this project.

Bob Phillips
12-04-2007, 01:49 AM
Something along the lines of



With Worksheets("Sheet1")
.Range("A2").Value = TextBox1.Text
.Range("B2").Value = CheckBox1.Value
.Range("C2").Value = TextBox2.Text
.Range("D2").Value = ComboBox1.Text
End With

blackie42
12-04-2007, 05:39 AM
I have built quite a few userforms recently that use optionbuttons/textboxes/comboboxes etc. Have even included things like automatically making sure textbox input is either words or numbers only, automatically changing text entry to uppercase, making sure numbers are parsed to excel to 2DP etc etc. Even splitting numbers up to parse as fractions.

A lot of this I've got from this forum by asking specific questions.

If you upload the sheet inc the form and explain what you are trying to achieve you'll get a lot further - I can probably help you now becos I have learnt so much - altho there are definitely people here with massive expertise who could probaly do a better/slicker job.

regards (and thanks to all the guys who have helped me so far)

Jon