I have a form in VBA which has a command button. Every time I click it I create a new command button.
How do I attach an event to the new buttons, so that when I click any of themm, I can run some code?
The code so far is as follows:-
Dim Mycmd As Control
Private Sub CommandButton1_Click()
i& = i& + 1
Set Mycmd = Controls.Add("Forms.CommandButton.1")
.Left = 12
.Top = 25 * i& + 25
.Caption = .Name