LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Trap a checkbox click

Excel 2002, WinXP
I posted this problem originally on 27 June. Tom Ogilvy responded and
helped me a great deal. He directed me to John Walkenbach's site:
http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine
and suggested that I could adapt John's method to my problem. My problem is
very similar to that addressed in John's article except that I have many
checkboxes in a sheet rather than many buttons in a UserForm.
My original post thread is no longer getting any responses, so I am starting
a new thread with this post. Any help anyone can provide would be much
appreciated.
From the code provided in John's article and the help I received from Tom, I
have the following:

In a class module:
Public WithEvents CheckBoxGroup As MSFORMS.CheckBox
Private Sub CheckBoxGroup_Click()
MsgBox "Hello from " & CheckBoxGroup.Name
End Sub

In a regular module:
Sub SetupCBGroup()
Dim CheckBoxCount As Long
Dim ctl As Control
' Create the CheckBox objects
CheckBoxCount = 0
For Each ctl In ActiveSheet.Controls 'Error on this line
If TypeName(ctl) = "CheckBox" Then
CheckBoxCount = CheckBoxCount + 1
ReDim Preserve CheckBoxes(1 To CheckBoxCount)
Set CheckBoxes(CheckBoxCount).CheckBoxGroup = ctl
End If
Next ctl
End Sub

When I run the SetupCBGroup macro I get:
Object doesn't support this property or method." in the "For Each ctl..."
line.

My objective is:
Know that a checkbox has been clicked on.
Know what checkbox has been clicked on.
Know the state of that checkbox (TRUE or FALSE)

Thanks for your help. Otto


 
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
How to enable to click a checkbox? Eric Excel Discussion (Misc queries) 2 May 6th 09 03:54 PM
Trap a checkbox click Otto Moehrbach Excel Programming 6 June 28th 05 09:25 PM
Click Checkbox Event Montana DOJ Help Desk Excel Programming 4 November 11th 04 04:25 AM
Using a macro to code a checkbox on click - Help Rog[_3_] Excel Programming 1 October 25th 04 07:16 PM
Trap Right CLick Insert Von Shean Excel Programming 1 January 22nd 04 04:42 AM


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

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

About Us

"It's about Microsoft Excel"