View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Can subroutines be called based on a commandbutton number?

Jeff,

No there isn't. Your way seems as good as you can get in VBA.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jeff Q" wrote in message
...
I have a form which will display a list of people, next to which a command
button will appear. If there are 4 people then four cb's will appear etc
etc.

The code I want to run doesn't change except for the position in the list,
so I could have

Private Sub cb1_click
call mysubroutine(1)
End Sub

Private Sub cb2_click
call mysubroutine(2)
End Sub

Is there any way for me to code the equivalent of -

Private Sub cb(index)_click
call mysubroutine(index)
End Sub

Thanks in advance (Apologies if this is a double post, my news server is
playing silly beggars)

Jeff