Hi all,
Hopefully this is a simple one, what would be the vba code to hide a button according to the value of a cell?
Thanks in advance,
Lee
Hi all,
Hopefully this is a simple one, what would be the vba code to hide a button according to the value of a cell?
Thanks in advance,
Lee
Here is a way:
![]()
Please Login or Register to view this content.
Thanks, appreciate that.
Is there a way of writing it instead of the Private Sub so that I can assign it to a button in Excel?
Cheers,
Lee
yes..
![]()
Please Login or Register to view this content.
Hello Lee & Steve,
Here is way to write the macro so the button name isn't hard code into the macro. This way the macro can be assigned to a Button without knowing its name. This works only with Forms buttons, not Control Toolbox command buttons.
Sincerely,![]()
Please Login or Register to view this content.
Leith Ross
Thank you very much!
One silly questions, if the button was called "Button 42" how is that effected?
I changed "CommandButton1" to "Button42" and "CommandButton42" but it didn't work.. any idea?
Cheers once more,
Lee
have a look at the properties of the bottom and be sure you are referring to by its (name)....Not its caption.
Thanks Leith and Steve
The problem in both scenarios for me is that there are several buttons on the sheet.. The one I need to hide is "Button42".
How is this effected in the vba code?
Thanks again,
Lee
Hello Lee,
Just add the button name into the string variable Button_Name.
Sincerely,![]()
Please Login or Register to view this content.
Leith Ross
Thanks again Leith![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks