I am making a userform for making a order in a pub for example.
So my intention is whenever I click on a commandbutton, it has to appear in my listbox. SO when I click on Cola
There will be in my listbox: Cola 1
The next time I click on cola, there should be Cola 2 but that doesn't work.
Here is my code:
Private Sub CommandButton1_Click()
With Sheets(3)
.Cells(Me.ComboBox1.ListIndex + 2, 2) = .Cells(Me.ComboBox1.ListIndex + 2, 2) + 1
End With
Dim i As Integer
i = 1
With Me.ListBox1
Me.ListBox1.ColumnCount = 2
Me.ListBox1.ColumnWidths = "60;60"
.AddItem
.List(0, 0) = CommandButton1.Caption
.List(0, 1) = i
End With
i = i + 1
End Sub
But he doesn't seem to remember the value of i And so when I click a second time on Cola, nothing changes.
Thanks in advance!