View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
brg brg is offline
external usenet poster
 
Posts: 15
Default Lock a control object

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

"Ryan H" wrote:

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

--
Cheers,
Ryan


"BRG" wrote:

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,