Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trigger an event on Checkbox change
In my program I import information and add checkboxes to each row as
it is imported. I have to programmatically name each checkbox. If a checkbox in one row is checked I need to call a procedure to copy that row to another sheet. Unfortunately due to the fact that I can have a hundreds of checkboxes on one sheet my code would become too large if I create a procedure for each checkbox using the Change event. The only way I could think of doing this is by using the change event from the worksheet but is there a way to locate what cell was changed that caused the event to be triggered? If I could locate the cell then I could write some code to check to see if it was linked to the checkbox. If anyone knows how I could find the changed cell or has a better work around I would appreciate it. Thanks, James |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trigger an event on Checkbox change
Hi James;
You can go into the worksheet object and use the following example. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'Check the column If ActiveCell.Column = 1 Then 'check if it is in the range you want If ActiveCell.Row 1 And ActiveCell.Row < 100 Then 'do your copy statement here. 'i used a message box for the example MsgBox "" End If End If End Sub Thanks, Greg -----Original Message----- In my program I import information and add checkboxes to each row as it is imported. I have to programmatically name each checkbox. If a checkbox in one row is checked I need to call a procedure to copy that row to another sheet. Unfortunately due to the fact that I can have a hundreds of checkboxes on one sheet my code would become too large if I create a procedure for each checkbox using the Change event. The only way I could think of doing this is by using the change event from the worksheet but is there a way to locate what cell was changed that caused the event to be triggered? If I could locate the cell then I could write some code to check to see if it was linked to the checkbox. If anyone knows how I could find the changed cell or has a better work around I would appreciate it. Thanks, James . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trigger an event on Checkbox change
This John Walkenbach tip can be adapted to Checkboxes on the worksheet
http://www.j-walk.com/ss/excel/tips/tip44.htm -- Regards, Tom Ogilvy "James" wrote in message om... In my program I import information and add checkboxes to each row as it is imported. I have to programmatically name each checkbox. If a checkbox in one row is checked I need to call a procedure to copy that row to another sheet. Unfortunately due to the fact that I can have a hundreds of checkboxes on one sheet my code would become too large if I create a procedure for each checkbox using the Change event. The only way I could think of doing this is by using the change event from the worksheet but is there a way to locate what cell was changed that caused the event to be triggered? If I could locate the cell then I could write some code to check to see if it was linked to the checkbox. If anyone knows how I could find the changed cell or has a better work around I would appreciate it. Thanks, James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trigger Event on Format Change | Excel Discussion (Misc queries) | |||
Trigger Event - Frank Stone | Excel Programming | |||
Trigger Event | Excel Programming | |||
Using a checkbox to trigger an email | Excel Programming |