Good Morning,
What I would like to happen is:
1) The user makes a selection from the combo box.
2) Then the user edits the text field.
3) After editing the text field, the field get updated, and then the user either can select again from the combo box, or hit either the next or the previous keys without losing the information placed in the text box.
I have a general idea, but I seem to be missing something. See Below:
Also, I've attached my file if needed. Any suggestions/help would be most appreciative.Dim dRow As Long Private Sub CommandButton1_Click() Dim ctrl As Control Dim rRnge As Range Me.CommandButton1.Enabled = False Me.CommandButton4.Enabled = True Sheet1.Range("A65536").End(xlUp).Offset(1, 0).Name = "rRnge" End Sub Private Sub CommandButton2_Click() Dim ctrl As Control dRow = dRow + 1 If Sheet1.Range("A" & dRow).Value = "" Then dRow = dRow - 1 Exit Sub End If LoadData End Sub Private Sub CommandButton3_Click() Dim ctrl As Control dRow = dRow - 1 If dRow < 2 Then dRow = 2 Exit Sub End If LoadData End Sub Private Sub CommandButton4_Click() dRow = WorksheetFunction.CountA(Range("A1:A2000")) + 1 Me.CommandButton4.Enabled = False LoadData End Sub Sub LoadData() ComboBox1.ControlSource = Cells(dRow, 1).Address TextBox2.ControlSource = Cells(dRow, 2).Address TextBox3.ControlSource = Cells(dRow, 3).Address End Sub Private Sub UserForm_Activate() Dim ws As Worksheet Set ws = Worksheets("Sheet1") For Each rngComboBox1 In ws.Range("rRnge") Me.ComboBox1.AddItem rngComboBox1.Value Next rngComboBox1 End Sub Private Sub ComboBox1_Change() If ComboBox1.ListIndex >= 0 Then TextBox2.Text = _ Sheets("Sheet1").Cells(ComboBox1.ListIndex + 2, 2).Value TextBox3.Text = _ Sheets("Sheet1").Cells(ComboBox1.ListIndex + 2, 3).Value End If End Sub Private Sub TextBox2_Change() If TextBox2.Value = True Then Sheets("Sheet1").Cells(TextBox2.Text).Value End If End Sub
R/s
ASDFG
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks