O
Olive Music
I have a form with two dozen command buttons on it that will all perform a
similar routine. Each of the buttons click events will have its own
subroutine in the VBA code, and all the subroutines will call the same
function. To have that function perform logic specific to a given button, I'd
have to pass the name of the button to the function. I'd rather use a
variable, so that for each button click event subroutine that I create, all I
have to do is copy and paste the statement from another button's click event
without having to subsequently change the function argument to be the
button's name. (I know that sounds lazy, but two dozen is a lot, and anyway
I'm curious if it can be done.) An alternative would be to somehow use the
subroutine's name as the value (since the name of a command button's click
event contains the button's name). But I haven't found a way to do that
either.
similar routine. Each of the buttons click events will have its own
subroutine in the VBA code, and all the subroutines will call the same
function. To have that function perform logic specific to a given button, I'd
have to pass the name of the button to the function. I'd rather use a
variable, so that for each button click event subroutine that I create, all I
have to do is copy and paste the statement from another button's click event
without having to subsequently change the function argument to be the
button's name. (I know that sounds lazy, but two dozen is a lot, and anyway
I'm curious if it can be done.) An alternative would be to somehow use the
subroutine's name as the value (since the name of a command button's click
event contains the button's name). But I haven't found a way to do that
either.