Thread: Help with Forms
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Office_Novice Office_Novice is offline
external usenet poster
 
Posts: 245
Default Help with Forms

Try Somthig like this


Option Explicit

Sub CommandButton1_Click()
Range("A2").Value = ComboBox1.Value '<-- You Can change you ranges
as needed
If ComboBox1.Value = "Marchwood" Then
Range("C2").Value = TextBox1.Value
ElseIf ComboBox1.Value = "Other Companies" Then
Range("C2").Value = TextBox1.Value
End If
End Sub

Private Sub UserForm_Initialize()
ComboBox1.AddItem "Marchwood"
ComboBox1.AddItem "Other Companies"
End Sub


"Leanne" wrote:

Hi,
I have been to http://www.contextures.on.ca/xlUserForm01.html#SetUp and
gained a lot of usefull information however the question I have does not seem
to be addressed there.

I want to create a form where the user selects an option from a combo box
and then enters the information relevant into the text box. This I have done
but what I do not know is how to get it to update the sheet in the correct
manner.

If someone selects Marchwood from the combo box and enters 01/05/08 in the
text box I want the record for Marchwood to be updated. Marchwood is in A2
and the data would need to update in C2 everytime Marchwood is chosen - and
the same for all the other companies.

Can anyone offer any suggestions?

Thanks