Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify the active checkbox

Status
Not open for further replies.

Jamesm601

Programmer
Feb 6, 2004
27
US
Hi all

I am developing an excel tool which will have as many as 50 checkboxes that will trigger a macro to create a chart and position it just below the checkbox. That macro is all written and works, but I am currently having to assign a different Macro to each checkbox to call the create_chart(row) macro, passing it a reference to the cell to which the activated checkbox is linked. The passing of that reference is the only reason the individual macros are needed. I'd like to avoid the file bloat associated with having a small calling routine assigned to each checkbox. I think I can do this if I can get the create_chart macro to recognize which checkbox was last acivated. My question is this. Is there a property/method (e.g. ActiveCheckbox) in VBA that will do this? If not, is there a property within the checkbox collection (e.g. Checkboxes(x).Link) that references the linked cell. That way I could use a for loop to find the activated checkbox.

Any help would be appreciated.

Thanks.
 
Take a look at the Shapes collection and the TopLeftCell property of a Shape object.

Hope This Help
PH.
 
Hi Jamesm601,

I don't think you can identify the active checkbox at all. That said, here is some of the information you ask for although I'm not quite sure how you expect to use it.

You must be using checkboxes from the Forms Menu (rather than the Control Toolbox) to have the option of assigning the same Macro to all of them.

Forms Menu Checkboxes (indeed all checkboxes) are members of a Sheet's Shapes Collection, and their Linked Cell is available as the LinkedCell Property of the Shape's ControlFormat. Note that not all Shapes have a ControlFormat Property so you may need to be careful running through the whole collection.

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top