View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeff Q Jeff Q is offline
external usenet poster
 
Posts: 4
Default Can subroutines be called based on a commandbutton number?

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