PDA

View Full Version : Solved: worksheet buttons



chungtinhlak
01-09-2009, 04:54 PM
Hi, I have many buttons in my worksheets and when the user open, they have to enter the password (i use input box for that), if they don't enter the password or enter it wrong, i want visible to be false to all these buttons.

I can't seem to find the name of the buttons. how to I references these button and how do i get to the name. I can only assign a macro to them.

Thanks in advance for your help.

GTO
01-09-2009, 05:21 PM
Greetings chungtinhlak,

How did you create the buttons? Or, more accurately, from which toolbar did they come from? The Forms toobar, or the vba toolbar (the Control Toolbox)?

Mark

Bob Phillips
01-09-2009, 05:33 PM
Select the button, and you will see its name in the names box at top left.

chungtinhlak
01-12-2009, 07:56 AM
ok, so i have 4 buttons (1 - 4) in 4 of my worksheets.

how come this doesn't work,

worksheets(1).button4.visible = false

georgiboy
01-12-2009, 08:48 AM
If it is a form button then it should be...

Sheet1.Shapes("Button 1").Visible = False

If it is an ActiveX command button then it should be...

Sheet1.CommandButton1.Visible = False

Hope this helps.

chungtinhlak
01-12-2009, 09:48 AM
thanks, that really help. :)

Bob Phillips
01-12-2009, 10:06 AM
If the are forms toolbar buttons, you van use



Worksheets("Sheet1").Buttons("Button 1").Visible = False