If I have a few Buttons but only one should work, how do I reach that?
For example I have:
Button1
Button2
Button3
Button4
But only one of them should work and the other not, but is it important that the "right" Button is not always the same, for example first it is Button3 but next time maybe Button1.
Sub AddEventToButtons
For X=1 to 3
AddEvent (Control("Button" & x),Click,""ButtonClicked")
Next
End Sub
Then when any button is pressed it goes here
Sub ButtonClicked
ButtonName=Sender.Name
Select ButtonName
Case "Button1"
Msgbox("Button1 was pressed")
Case "Button2"
Msgbox("Button2 was pressed")
Case "Button3"
Msgbox("Button3 was pressed")
End select