Hello,
I would auto number for each name in listbox.
I will fill textboxes and copy to listbox . currently will auto number 1,2,3 consecutively
but what I want when add new name for second column then will start again 1,2,.... until add new name .so autonumbering begins from name in column 2 and elements in column 4 until finshing last elemnt in column 4 for the same name.
I put example in sheet how should show in first column after add new name in listbox .
important: in textbox1,2 will not repeat adding same name,invoice no after fill from first time , just I add elemnts in column 4 for the same name .
Dim lindex As Long
Private Sub CommandButton1_Click()
Dim idx As Long
With Me.ListBox1
.AddItem
For idx = 1 To 6
.List(.ListCount - 1, idx) = Me.Controls("TextBox" & idx)
Next idx
.List(lindex, 0) = lindex + 1
lindex = lindex + 1
End With
End Sub
thanks