Coding for checkbox (SC)

  • Thread starter Thread starter sreeram.i.c
  • Start date Start date
S

sreeram.i.c

Can anyone pls help me with this code.

Sub Validation()
If CheckBox1.Value = Checked Then
Worksheets("Form").Range("F_Name").Enabled = True
Else
Worksheets("Form").Range("F_Name").Enabled = False
End If

End Sub

I have written this code for a check box. If the check box is checked
then a cell named F_Name should be able to take in values entered. If
the check box is not selected then the F_Name field should be
deactivated or greyed out so that no values can be entered.

The code above throws a run time error '438': Object doesn't support
this property or method.

Can anyone help me fix this.. is this a code error or Excel property
that needs to be changed

Thanks in advance for you help.
 
Cells don't have an enabled property. You can set the Locked property to
true or false. However, to activate it, the worksheet must be protected.
And you must turn off protection to change the locked property.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Cells don't have an enabled property. You can set the Locked property to
true or false. However, to activate it, the worksheet must be protected.
And you must turn off protection to change the locked property.

Bob Flanagan
Macro Systemshttp://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel












- Show quoted text -

I did try your fix, the error message does not appear however if the
check box is unchecked it does not lock the cell F_Name. I also
protected the sheet and truned off the the locked option in format
cell properties.
 

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

Back
Top