PDA

View Full Version : Check box control on a worksheet



Jacob Edison
01-26-2011, 01:03 AM
Hi everyone,

Finally found my user name and password for vbeexpress... :)

ok, let me get to my question.

I have a check box ("CB1") on a worksheet (say "Sheet1").
I'm trying to use VBA to check / uncheck the Check box. Normally i user the following
CB1.Value = True

However, i have several Check Boxes on the form, so I declare a Variable (Dim iName As Variant) to store the name of the Check Box

Now is there a way I can Use this to reffer to by check box. Something like
Me.Controls(iName).Value = True

When ever I try this it says "Compile error: Method or data member not found"

Can someone please :help :help :help :help !!!

Bob Phillips
01-26-2011, 01:08 AM
Me.CheckBoxes(iName).Value = True

Jacob Edison
01-26-2011, 08:12 AM
Thank you xld.

I tried this but i get the following message:

Run-time error '1004':

Method 'CheckBoxes' of object '_worksheet' failed

:(

shrivallabha
01-26-2011, 08:24 AM
Not sure. Try changing:
Dim iName As String
It should get double quotes the Controls syntax needs.

Bob Phillips
01-26-2011, 08:48 AM
Maybe it is ACtiveX



Me.OLEObjects(iName).Object.Value = True

Jacob Edison
01-26-2011, 01:41 PM
Thank you Shrivallabha and xld. Worked like a charm.
U guys are F.A.N.tastic....
:bow::bow: