Hi,
I've been using some code to dynamically create a button in an excel worksheet based on the output of a case statement.
The code is as follows:
Is it possible to automatically write the on_click code for the button at the time of the buttons creation?
The code I will be using is:
Any help would be greatly received.
Regards
tubbsy123
I've been using some code to dynamically create a button in an excel worksheet based on the output of a case statement.
The code is as follows:
Code:
Sheet1.OLEObjects.Add ClassType:="Forms.CommandButton.1", Left:=0, Top:=0, Width:=126.75, Height:=25.5
Sheet1.Shapes(Sheet1.Shapes.Count).OLEFormat.Object.Object.Caption = "Click Me"
Is it possible to automatically write the on_click code for the button at the time of the buttons creation?
The code I will be using is:
Code:
Private Sub btnNext_Click()
Call Macro1
End Sub
Any help would be greatly received.
Regards
tubbsy123