kanadaaa
Active Member
- Joined
- Dec 29, 2019
- Messages
- 348
- Office Version
- 365
- Platform
- Windows
Hi, I have a question about the behaviour of buttons.
I have CommandButton1 and CommandButton2 on sheet1 and they overlap in position.
What I want to do is hide CB1 and show CB2 when CB1 is clicked, and hide CB2 and show CB1 when CB2 is clicked.
Then I tried this code:
It works quite well, but I'm not fully satisfied because when I keep pressing the mouse button, the invisible button "flashes", or becomes visible for an instant (when I release the mouse button the visible button becomes invisible and the invisible button becomes visible, just in the way I want the code to work).
I don't want it to "flash" on click. How could I solve this problem? Thank you.
I have CommandButton1 and CommandButton2 on sheet1 and they overlap in position.
What I want to do is hide CB1 and show CB2 when CB1 is clicked, and hide CB2 and show CB1 when CB2 is clicked.
Then I tried this code:
VBA Code:
Private Sub CommandButton1_Click()
CommandButton1.Visible = False
CommandButton2.Visible = True
End Sub
Private Sub CommandButton2_Click()
CommandButton2.Visible = False
CommandButton1.Visible = True
End Sub
I don't want it to "flash" on click. How could I solve this problem? Thank you.