We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Excel Hide button based on condition

Medium Priority
Last Modified: 2012-06-21
I added a button on my excel sheet and assigned a macro to it.

Is it possible to hide the button based on value on a particular cell.. like H1? If H1 contains "pass", only then the button should appear.

This is NOT a COMMAND Button. A simple Form button.
Watch Question

if H1="Pass" then
ActiveSheet.SHAPES("Button 1").visible=True
ActiveSheet.SHAPES("Button 1").visible=False

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


How is it supposed to work?

I tried adding the worksheet_change sub... saved the sheet, reopened the same.. the button existed whether or not the value exists in H1.

I opened the sheet you provided, and it works. But, not on my side.


how / where do I need to add the code?


Never mind, I figured it out :)

Thank you.

With all due respect, why did you accepted the solution from hitsdoshi1? If you use that code, you will get an error because it is missing the object sheet reference! The code is not completed and correct so you shouldn't accept that solution.

I would appreciate your comments on this please.


I would appreciate, for future reference, that you at least respond to my question!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.