Buttons and Sheet Protection?

G

G Lykos

Greetings! Have a worksheet with a button and event code. When the sheet
is unprotected, the button and code work fine. When the sheet is protected,
and some cells are selected to be locked but the one with the button is not,
the button doesn't work. There is a host of options for sheet protection,
allowing the user to change this, that, and the other while the sheet is
protected, but none of them seem directly related to this. What would be
interfering with button operation, and/or how can it be enabled on the
protected sheet?

Thanks,
George
 
R

Rowan Drummond

I don't think that protecting the sheet will stop the button from being
clicked but it may prevent the associated event from performing some
actions. What is the event code doing?

Regards
Rowan
 
G

G Lykos

Rowan, the code never gets to run.

When the sheet is unprotected and I pass the cursor over the cell containing
the two buttons, it forms a hollow cross when over open space and becomes a
hand+finger when over the button, allowing the button to be pressed and
causing the code to run.

When the sheet is protected, the cursor remains a hand+finger everywhere in
the cell, and the buttons do not respond to a click. Ideas?

Thanks,
George
 
G

G Lykos

Gary, checked, and it does not appear to be in debug mode. Other ideas?

Thanks,
George
 
G

Gary Keramidas

are you in design mode? click the control toolbox on and click the design
icon off
 
D

Dave

If the code run by the button tries to change a protected cell, the
protection interrupts the code.
Try inserting these 2 lines into your code, one at the beginning, the other
at the end.

ActiveSheet.Unprotect
<Your Code>
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
 
G

G Lykos

Dave, thanks for the suggestion - a solution ended up being down this path.
Specific steps to remedy the problem: unlock the cell where the buttons are
located, and .Protect Contents:=False at opening to initialize. Don't
understand the intuitive logic of the latter, but it works.

Regards,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top