PC Review


Reply
Thread Tools Rate Thread

Coding for checkbox (SC)

 
 
sreeram.i.c@gmail.com
Guest
Posts: n/a
 
      26th Mar 2007
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.

 
Reply With Quote
 
 
 
 
Bob Flanagan
Guest
Posts: n/a
 
      26th Mar 2007
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
sreeram.i.c@gmail.com
Guest
Posts: n/a
 
      26th Mar 2007
On Mar 26, 5:15 pm, "Bob Flanagan" <nore...@noreply.net> wrote:
> 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
>
> <sreeram....@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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.- Hide quoted text -

>
> - 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox coding problem supersonix Microsoft Access 3 5th Sep 2007 08:13 PM
Is it possible to attach a label to a checkbox for coding purposes =?Utf-8?B?TmF0aGFuLWJmaGQ=?= Microsoft Access Forms 6 6th Dec 2006 12:50 AM
Form checkbox coding query happywitchie Microsoft Access Form Coding 2 15th Jun 2006 10:37 AM
Listbox with a checkbox? UI & Coding Suggestions? Grahammer Microsoft Access Forms 3 4th Nov 2004 06:16 AM
Master-Detail Datagrid -checkbox (once tick the checkbox, all the child checkbox is ticked) Agnes Microsoft VB .NET 0 16th Aug 2004 11:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:34 AM.