View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BHatMJ BHatMJ is offline
external usenet poster
 
Posts: 26
Default Control Click Subroutine (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.Comma ndButton.1", Left:=100,
Top:=topPos, Width:=50, Height:= 30).Select
topPos = topPos + 75
Next lp

End Sub