excelvbameche
New Member
- Joined
- Jul 21, 2019
- Messages
- 2
Hi - I'm trying to figure out how to run a line of code if one of three buttons was selected in a shown UserForm1.
This is what I have so far:
Private Sub CommandButton1_Click()
If UserForm1.CommandButton1.TakeFocus******* Then
Do This
ElseIf UserForm1.CommandButton2.TakeFocus******* Then
Do This
ElseIf UserForm1.CommandButton3.TakeFocus******* Then
Do This
End If
End Sub
...
User Form:
Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
UserForm1.Hide
End Sub
Not sure if the ".TakeFocus*******" handle is the way to go, or what I'm doing wrong in general.
Thank you for your time!
This is what I have so far:
Private Sub CommandButton1_Click()
If UserForm1.CommandButton1.TakeFocus******* Then
Do This
ElseIf UserForm1.CommandButton2.TakeFocus******* Then
Do This
ElseIf UserForm1.CommandButton3.TakeFocus******* Then
Do This
End If
End Sub
...
User Form:
Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
UserForm1.Hide
End Sub
Not sure if the ".TakeFocus*******" handle is the way to go, or what I'm doing wrong in general.
Thank you for your time!