Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger Event on Format Change Zone[_3_] Excel Discussion (Misc queries) 4 August 25th 07 05:43 PM
Trigger Event - Frank Stone Todd Huttenstine Excel Programming 0 July 14th 04 09:04 PM
Trigger Event Todd Huttenstine Excel Programming 2 July 14th 04 06:50 PM
Using a checkbox to trigger an email Chris Excel Programming 1 August 12th 03 11:00 PM


All times are GMT +1. The time now is 03:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"