Lock a control object


B

BRG

I have a 'Lock' button that uses a macro to toggle specific cells in a
worksheet between protected and unprotected (allowing only unlocked cells to
be selected). I also have some combo boxes on the worksheet that I would
like to protect in the same way (ie. when locked they can't be selected). Is
this possible?

Thanks,
 
Ad

Advertisements

R

Ryan H

YOu can use these lines of code. Since you have a toggle button you can just
set the Enable property of your comboboxes equal to the toggle button value.
Hope this helps! If so, click "YES" below.


' lock your combobox
ActiveSheet.DropDowns("Drop Down 1").Enabled = False

or

' unlock your combobox
ActiveSheet.DropDowns("Drop Down 1").Enabled = True

or

' use the toggle button value
ActiveSheet.DropDowns("Drop Down 1").Enabled = ToggleButton1.Value
 
Ad

Advertisements

B

BRG

Thanks Ryan,

The 'Enabled' property was the one I was looking for. I used a ComboBox
from the Controls toolbar, so I used 'OLEObjects' instead of 'Dropdowns' in
the entries below.

BRG
 

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