Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Change Event with Check Box?

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Change Event with Check Box?

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Change Event with Check Box?

Thanks Tom, can this be done for the entire list of checkboxes? and would
you mind giving an example of the change event for a or any check box in the
sheet?

"Tom Ogilvy" wrote:

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Change Event with Check Box?

Private Sub CheckBox1_Change()
msgbox "Test - CheckBox1")
End Sub

If you want to handle all checkboxes with a single event, you could use a
technique documented by John Walkenbach:

http://www.j-walk.com/ss/excel/tips/tip44.htm

--
Regards,
Tom Ogilvy


"John" wrote:

Thanks Tom, can this be done for the entire list of checkboxes? and would
you mind giving an example of the change event for a or any check box in the
sheet?

"Tom Ogilvy" wrote:

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Change Event with Check Box?

Thanks again, I have two questions.

1. One what does this code do... here is my attempted modification
2. Where do I insert a Call to do what I want to happen when one of the 20
or so checkboxes is checked?

Thanks so much...


"Tom Ogilvy" wrote:

Private Sub CheckBox1_Change()
msgbox "Test - CheckBox1")
End Sub

If you want to handle all checkboxes with a single event, you could use a
technique documented by John Walkenbach:

http://www.j-walk.com/ss/excel/tips/tip44.htm

--
Regards,
Tom Ogilvy


"John" wrote:

Thanks Tom, can this be done for the entire list of checkboxes? and would
you mind giving an example of the change event for a or any check box in the
sheet?

"Tom Ogilvy" wrote:

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Change Event with Check Box?

the code....

Option Explicit
Dim CBX() As New Class1

Sub ShowDialog()
Dim CBXCount As Integer
Dim ctl As Control

' Create the Button objects
CBXCount = 0
For Each ctl In ActiveSheet.Controls
If TypeName(ctl) = "Checkbox" Then
If ctl.Name < "OKButton" Then 'Skip the OKButton
CBXCount = CBXCount + 1
ReDim Preserve CBX(1 To CBXCount)
Set CBX(CBXCount).checkboxGroup = ctl
End If
End If
Next ctl
'UserForm1.Show
End Sub

"Tom Ogilvy" wrote:

Private Sub CheckBox1_Change()
msgbox "Test - CheckBox1")
End Sub

If you want to handle all checkboxes with a single event, you could use a
technique documented by John Walkenbach:

http://www.j-walk.com/ss/excel/tips/tip44.htm

--
Regards,
Tom Ogilvy


"John" wrote:

Thanks Tom, can this be done for the entire list of checkboxes? and would
you mind giving an example of the change event for a or any check box in the
sheet?

"Tom Ogilvy" wrote:

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Change Event with Check Box?

send me a sample file pertinent to the situation (not some huge thing) that
represents the critical aspects. Tell me what you want to happend when a
checkbox is checked or unchecked. In clude the code you want to run or an
explanation. Have the checkboxes on the sheet.

I will set it up for you as an example.



--
Regards,
Tom Ogilvy

"John" wrote:

the code....

Option Explicit
Dim CBX() As New Class1

Sub ShowDialog()
Dim CBXCount As Integer
Dim ctl As Control

' Create the Button objects
CBXCount = 0
For Each ctl In ActiveSheet.Controls
If TypeName(ctl) = "Checkbox" Then
If ctl.Name < "OKButton" Then 'Skip the OKButton
CBXCount = CBXCount + 1
ReDim Preserve CBX(1 To CBXCount)
Set CBX(CBXCount).checkboxGroup = ctl
End If
End If
Next ctl
'UserForm1.Show
End Sub

"Tom Ogilvy" wrote:

Private Sub CheckBox1_Change()
msgbox "Test - CheckBox1")
End Sub

If you want to handle all checkboxes with a single event, you could use a
technique documented by John Walkenbach:

http://www.j-walk.com/ss/excel/tips/tip44.htm

--
Regards,
Tom Ogilvy


"John" wrote:

Thanks Tom, can this be done for the entire list of checkboxes? and would
you mind giving an example of the change event for a or any check box in the
sheet?

"Tom Ogilvy" wrote:

Yes, use the Change event of the checkbox.

--
Regards,
Tom Ogilvy


"John" wrote:

I want to fire code based on a check box being checked or unchecked. The
worksheet change event doesn't seem to recognise the True/False changes when
I check box is checked. My code is simple.

Private Sub Worksheet_Change(ByVal Target As Range)
'If Not Application.Intersect(Range("i31:i60"), Target) Is Nothing Then
If Not Intersect(Target, Range("i31:i60")) Is Nothing Then
MsgBox "test"
End If
End Sub

Where column I contains true or false as a cell value based on the checkbox.
Can I get this to fire off of check boxes themselves?

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
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Paste Event Check Nathaniel W. Polky[_2_] Excel Programming 2 December 10th 05 12:22 AM
Change event and calculate event Antje Excel Programming 1 March 29th 05 09:03 PM
Change Event.....Spell Check CLR Excel Programming 7 February 1st 04 05:05 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM


All times are GMT +1. The time now is 01:02 AM.

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"