Set properties of a Check Box

P

PCLIVE

I've used something like this to set the properties of a ToggleButton.

Me.ToggleButton5.Value = False

How can I do this same sort of thing with a Check Box, also created from the
Control Toolbox?

I've tried the similar syntax, but I get an error.

Me.CheckBoxName.Value = False 'Invalid use of Me keyword
ActiveSheet.Shapes("CheckBoxName").Value = False 'Object doesn't
support this property or method

What code is necessary to set the properties of a checkbox?

Thanks in advance,
Paul





--
 
R

Rick Rothstein

You can't use Me in the Immediate Window if that is what you were doing.
This works fine in a code procedure though...

Me.CheckBox1.Value = True

In the Immediate Window, you can refer to the worksheet directly or via the
ActiveSheet object...

Worksheet("Sheet1").CheckBox1.Value = True

or

ActiveSheet.CheckBox1.Value = True
 
P

PCLIVE

Never mind. I think I got it.

ActiveSheet.OLEObjects("CheckBoxName").Object.Value = False
 
P

PCLIVE

Thanks Rick. I could have sworn that I tried that. I guess I didn't.

Thanks again.

--

Rick Rothstein said:
You can't use Me in the Immediate Window if that is what you were doing.
This works fine in a code procedure though...

Me.CheckBox1.Value = True

In the Immediate Window, you can refer to the worksheet directly or via
the ActiveSheet object...

Worksheet("Sheet1").CheckBox1.Value = True

or

ActiveSheet.CheckBox1.Value = True
 

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

Top