ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically set checkbox values on worsheet (https://www.excelbanter.com/excel-programming/401502-re-programmatically-set-checkbox-values-worsheet.html)

Dave Peterson

Programmatically set checkbox values on worsheet
 
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)

Dale Fye wrote:

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!

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


--

Dave Peterson

Dale Fye

Programmatically set checkbox values on worsheet
 
Thanks, Dave.

Exactly what I was looking for.

Dale
--
Email address is not valid.
Please reply to newsgroup only.


"Dave Peterson" wrote:

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)

Dale Fye wrote:

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!

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


--

Dave Peterson



All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com