add item in ListBox1 and 2
Private Sub CommandButton5_Click()
'ListBox1.AddItem TextBox1/2.Value
Dim NextRw As Long
With Sheet2 'find next empty row using Column A
NextRw = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
.Cells(NextRw, 1).Value = Me.TextBox1.Value
.Cells(NextRw, 2).Value = Me.TextBox2.Value
End With
Unload Me
UserForm1.Show
End Sub
Private Sub CommandButton6_Click()
'ListBox2.AddItem TextBox1/2.Value
Dim NextRw As Long
With Sheet3 'find next empty row using Column A
NextRw = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
.Cells(NextRw, 1).Value = Me.TextBox1.Value
.Cells(NextRw, 2).Value = Me.TextBox2.Value
End With
Unload Me
UserForm1.Show
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = Array("A", "B")
ListBox1.Visible = False
ListBox2.Visible = False
CommandButton5.Visible = False 'add record to listbox1
CommandButton6.Visible = False 'add record to listbox2
End Sub
and so on...
Bookmarks