Can subroutines be called based on a commandbutton number?

  • Thread starter Thread starter Jeff Q
  • Start date Start date
J

Jeff Q

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
 
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)
 
Back
Top