Shapes visible is automatically true when pressing ctrl + C/X

huuchinh1893

New Member
Joined
Sep 13, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,
I am building a mini tool using excel and vba but I am facing a problem.
I have a rectangle shape is "Rectangle 1" and I use a button to control its visible status (true/false) as below
VBA Code:
If Shapes("Rectangle 1").Visible = True Then
    Shapes("Rectangle 1").Visible = False
Else
    Shapes("Rectangle 1").Visible = True
End If
This simple code works fine definitely. The problem happened when I press Ctrl + C any cell in the same sheet, the shape automatically visible back if it was invisible status and I couldn't select the shape or control anything even others still work normally. The excel file is not hanged or crashed.
I checked the visible status at that time but it is not change (still visible = false).
My Office version: 2016 MSO (16.0.4266.1001) 64-bit
Thank for your helps!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Maybe you're using your button's click event or so and it's being fired even when you think it isn't, like when you press CTRL-C... add a debug.print "change..." in your code to test this idea.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top