-
[RESOLVED] Many Buttons
Is it possible to have one subroutine to cover the click event of many buttons?
I have a whole column of buttons, in a spreadsheet, that call a public routine, "rowpick", to display further info from an MS Access database. Each button detirmines which data to extract depending on a cell in the row it is next to in the Excel Spreadsheet.
I currently have a a private sub for each button but I am expanding to 200 or more rows.
HTML Code:
Private Sub cmdDetails14_Click()
rowpick (14)
End Sub
Code:
Public Sub rowpick(n As Byte)
Is there away to get a variable into the button subroutine and use it for a loop or something so I only need one subroutine that can detirmine which button has been pushed?
-
Re: Many Buttons
you can do this pretty easily in VB, using the buttons index, but not with VBA
-
Re: Many Buttons
with a little code you can do it quite close.
http://vbforums.com/showthread.php?t=412664
-
Re: Many Buttons
Thanks mate. I'll give it a bash next week.