Lock a control object

  • Thread starter Thread starter BRG
  • Start date Start date
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,
 
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
 
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
 
Back
Top