View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Enable and disable worksheet controls?

Inside the VBE, tools|References and check
MS Forms 2.0 Object library

(And are your checkboxes/optionbuttons from the control toolbox toolbar or the
Forms toolbar?)



william deleo wrote:

I am getting a compile error:

"User-defined type not defined" with reference to line:

TypeOf obj.Object Is MSForms.CheckBox

???

-----Original Message-----
Control Toolbox Toolbar Controls:

Sub Tester1()
Dim obj As OLEObject
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Or _
TypeOf obj.Object Is MSForms.OptionButton Then
obj.Object.Enabled = False
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"William Deleo"

wrote in message
...
Hello,

Is there a way to disable worksheet controls? For
example, I have a sheet with a series of radio buttons

and
check boxes. After some data is entered and the buttons
and check boxes are set, I'd like to disable them so

thay
cannot be inadvertantly changed. I thought the lock and
protect features would address this, but it seems like
they do not effect the value of the control (only the
location and size and so forth).

In the end, I'd like a macro button on the sheet which
enables and disables particular controls based on the
value of a sepparate check box. I.e., the user sets the
check box to lock (box checked), and calls the macro (by
pressing a button) to disable particular controls and
fixing their values. Or, the user sets the check box to
unlock (box uncheched), and calls the macro to enable

the
particular controls, allowing their values to be reset.

Thanks so much for your time!
William DeLeo




.


--

Dave Peterson