Hello All,
Reaching out for some help once again. I have a listbox that is populated from a combobox when a worksheet is selected. When I click on a selection in the listbox it populates the corresponding textboxes below. I have the below code that’s supposed to edit whatever selection I make, but instead it edits the entire table. My second problem is that it only works (if you can call it that) on one worksheet (Re-Enlistments). I want to be able to edit all the worksheets in the combobox. Code is below and file is attached. As always, I’m grateful for any assistance.
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 2 To Range("B10000").End(xlUp).Row
'If Cells(i, 1) >= 1 Then
If Me.ListBox1.List(Me.ListBox1.ListIndex, 0) = "" Then
Cells(i, 2) = TextBox1.Text
Cells(i, 3) = TextBox2.Text
Cells(i, 4) = TextBox3.Text
Cells(i, 5) = TextBox4.Text
Cells(i, 6) = TextBox5.Text
Cells(i, 7) = TextBox6.Text
Cells(i, 8) = TextBox7.Text
Cells(i, 9) = TextBox9.Text
Cells(i, 10) = TextBox10.Text
End If
Next i
MsgBox "Data has been Saved!", vbInformation
Unload Me
End Sub
Bookmarks