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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXCEL: Is there a way to detect mouse events globally?

Status
Not open for further replies.

planix

Technical User
Dec 3, 2002
22
Hi,

I have a spreadsheet with 275 checkboxes on it. When a checkbox is selected a calculation is performed dependent on it's state and caption values. The same calculation is performed for each checkbox and I have made this a function.

The question: is there a way to trap for mouse events so I only need one routine to identify whether a checkbox has been selected and if so to pass on that checkbox's .Value and .Caption to the function? Otherwise I need to attach the function call to each checkbox and I figure there has to be a neater way ... I just don't know it.

Each checkbox is default named (CheckBox1, CheckBox2... CheckBox275)

Thanks

Alistair
 
Hi Alistair,

If I understand your question properly:
as your checkboxes are on a spreadsheet, I suppose their values are linked to a cell on the spreadsheet. If you organise these linked cells properly (e.g. all on the same row, or you can also give them a name linked1, linked2, etc), when you click on a checkbox, the value of the coresponding linked cell will change and you can trap the event globally in Worksheet_Change. Then you check the target cell which will give you the value of the caption and the number of the checkbox and you can pass the information to your function.

Nathalie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top