ActiveX CommandButton becomes non-clickable after making it invisible and visible

liyunyi

New Member
Joined
Jun 5, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I encounter with a problem that Commandbutton works well before hiding it. But once making it hidden and back, the button suddenly does not react to click_event anymore. I have to close the excel and reopent it, then it recovers.

I just have searched the problem. There are similar questions shown but could not find a proper answer. Can anyone helps? Much Appreciated!

An exactly same situation there: https://answers.microsoft.com/en-us...ly-after/a73aa0a1-5eef-4684-8118-f8b99c996c0c

In my case, I want to filter the table and at the meanwhile hide the commandbutton with caption corresponding to unchosen row, plesae see the image
 

Attachments

  • Snipaste_2022-06-05_14-38-40.png
    Snipaste_2022-06-05_14-38-40.png
    55.9 KB · Views: 44
  • Snipaste_2022-06-05_14-39-18.png
    Snipaste_2022-06-05_14-39-18.png
    36.6 KB · Views: 44
  • Snipaste_2022-06-05_14-40-03.png
    Snipaste_2022-06-05_14-40-03.png
    58.6 KB · Views: 44

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
There are similar questions shown but could not find a proper answer.
I don't see what's wrong with the answer given at the link. The problem seems to be that activex controls on a sheet don't behave well after hiding. The explanation given is that you see the button but it's not really there. The solution given is to run code to reposition them to where they should be. If you don't like that idea, consider using form control button instead, or disabling commandbutton instead of hiding, or trapping the click event if the condition you use to hide the button happens to exist.
 
Upvote 0
Solution
Genius! Thats exactly what happen. Sry I couldnt understand the answer at first time. Your words inspired me. Yes, after unhiding the button appears on the cells which is not really there. I have looked into the TopLeftCell.Address from Attribute of ActiveX control, it changes. Therefore, I do what you say, reposition it to where it appears on. It works well now!

Thanks:)
 
Upvote 0

Forum statistics

Threads
1,215,196
Messages
6,123,575
Members
449,108
Latest member
rache47

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