Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
brg brg is offline
external usenet poster
 
Posts: 15
Default Lock a control object

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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Lock a control object

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,

  #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,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
How to lock an ActiveX Control box on the spreadsheet? Ange Excel Worksheet Functions 1 October 29th 08 12:31 AM
lock position of Word object in protected excel spreadsheet dheitz Excel Worksheet Functions 1 October 1st 07 12:53 PM
Lock cell control conditionally? Carl R. Excel Discussion (Misc queries) 0 January 18th 07 05:52 PM
Out of control scroll lock?? Oops Excel Discussion (Misc queries) 2 January 29th 06 10:10 PM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"