View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Capturing Checkbox Events

Mark,

Not tried them myself in this particular instance, but here are 3 thoughts
or you to investigate

1) Add the checkbox click code to your workbook for all possible checkboxes
statically, and as each checkbox is added it will automatically pick up its
module, If they all do the same sort of thing, the actual doing code could
be put in a separate called module to reduce the amount of code. Obviously,
the problem here is that you need to know the limit.

2) Look at Chip Pearson's page on dynamically adding VBA code at
http://www.cpearson.com/excel/vbe.htm. This is complex, but means that you
should be able to add a checkbox click code procedure on the fly as well.

3) Check out John Walkenbach's technique for handling multiple controls at
http://j-walk.com/ss/excel/tips/tip44.htm. John's example uses command
buttons, but should be adaptable to checkboxes.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mark D'Agosta" wrote in message
. net...
I have code that dynamically creates a checkbox on each new line added to

a
worksheet (i.e. Activesheet.Checkboxes.Add statement is executed in the
Worksheet_Change event) and each newly created checkbox is linked to an
underlying cell. However, once these dynamically created checkboxes are
placed on the form, I don't seem to have any means of capturing clicks on
them. Even though when I click the checkbox, the value in the LinkedCell
changes accordingly, the Worksheet_Change event is not triggered. There

is
no Checkbox_Click for me to code to since they're created on the fly.
Anyone have any idea how I can capture the clicks on these checkboxes?

Thanks,

Mark D.