ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checkbox Macros (https://www.excelbanter.com/excel-programming/286610-checkbox-macros.html)

Joe Strommen

Checkbox Macros
 
I am making a Risk Management spreadsheet for my work.
My macros are two columns of roughly 100 checkboxes, and
a print macro. Each checkbox is to update a hidden
column (with either a 1 or 0), and the print macro hides
any row with a 0 in the hidden column before printing.
This way only the relevant rows get printed.

I have tried two approaches to this, and had problems
with each. When I use the checkbox from the Forms
toolbar, I can't move and size it with the rows, so if a
user re-sizes the row, the checkboxes are no longer
aligned with the rows. When I use the checkbox from the
Control Toolbox, I have to go through each checkbox (over
200) and write a unique line of code to run. Copying and
pasting these checkboxes does not transfer the code.

Does anybody have any good ideas on how to solve my
problem? Thanks much.

Tom Ogilvy

Checkbox Macros
 
Use control toolbox checkboxes and use John Walkenbach's technique to handle
them with a single macro:

http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine

His example uses commandbuttons, but can be easily adapted to checkboxes and
the click or change event.

--
Regards,
Tom Ogilvy


Joe Strommen wrote in message
...
I am making a Risk Management spreadsheet for my work.
My macros are two columns of roughly 100 checkboxes, and
a print macro. Each checkbox is to update a hidden
column (with either a 1 or 0), and the print macro hides
any row with a 0 in the hidden column before printing.
This way only the relevant rows get printed.

I have tried two approaches to this, and had problems
with each. When I use the checkbox from the Forms
toolbar, I can't move and size it with the rows, so if a
user re-sizes the row, the checkboxes are no longer
aligned with the rows. When I use the checkbox from the
Control Toolbox, I have to go through each checkbox (over
200) and write a unique line of code to run. Copying and
pasting these checkboxes does not transfer the code.

Does anybody have any good ideas on how to solve my
problem? Thanks much.





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

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