I have a simple Userform with 14 command buttons. Depending what routine and conditions 2 or more Command Buttons will become visible.
I found the class code to that returns the pressed button's Caption and that works, but I need to get the clicked Button's TAG.
I do not want to to add 14 Sub CommandButtonx_Click routines, I just need one common routine that will run one macro that will return the TAG value of the button clicked and the rest of the code.
- Private Sub UserForm_Initialize()
- Dim ctrl As MSForms.control
- Dim clsObject As Class1
- 'Create New Collection To Store Custom
- Set colButton = New Collection
- For Each ctrl In Me.Controls
- If TypeName(ctrl) = "CommandButton" Then
- Set clsObject = New Class1
- Set clsObject.Button = ctrl
- colButton.Add clsObject
- End If
- End Sub
Something similar but to Return the TAG
Thanks in advance