B
BHatMJ
HELP! I am adding a dynamic number of control buttons to a worksheet
dependent upon user input during run time (see my code below). I need to add
code to each of these buttons (also during run time) so that a subroutine is
called when the user selects the button.
ANY help would be greatly appreciated!!!
Sub AddCtrl(nCnt As Integer)
topPos = 20
' nCnt is an integer set at run time by the user
For lp = 1 to nCnt
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Left:=100,
Top:=topPos, Width:=50, Height:= 30).Select
topPos = topPos + 75
Next lp
End Sub
dependent upon user input during run time (see my code below). I need to add
code to each of these buttons (also during run time) so that a subroutine is
called when the user selects the button.
ANY help would be greatly appreciated!!!
Sub AddCtrl(nCnt As Integer)
topPos = 20
' nCnt is an integer set at run time by the user
For lp = 1 to nCnt
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Left:=100,
Top:=topPos, Width:=50, Height:= 30).Select
topPos = topPos + 75
Next lp
End Sub