Programmatically set checkbox values on worsheet

G

Guest

I have a worksheet I am using as a report for data that is stored in another
worksheet in my workbook.

I have some checkboxes that I added to the worksheet using the Control
Toolbox, all of which are named. How can I set the values (checked or
unchecked) of these checkboxes based on the values in the other worksheet?
For other cells in the report, I am using:

shtDest.Cells(10, 2) = shtGap.Cells(GapPointer, 16)

I have tried:

shtDest.OLEObjects("chk_Doctrine").Checked = shtGap.Cells(GapPointer, 3)

but this generates an "Object doesn't support this property or method" error.

While searching for an answer, I've come to realize that there are two types
of control toolboxes (Control and Form) and I selected the Control Toolbox.
If I need to change that to the Forms toolbox, now would be a good time to
let me know.

Thanks for your feedback.

Happy Thanksgiving!
 
D

Dave Peterson

How about

ShtDest.OLEObjects("CheckBox1").Object.Value _
= CBool(shtGap.Cells(GapPointer, 16).Value = True)

Remember, it's looking for true/false (if it's two state)
 

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

Similar Threads


Top