LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default generic checkbox click form event handler?

Add a class module named Class1 (later name as say clsCBxEvnts)

' code in Class1
' add other events, select cbx from the middle dropdown
' then other events from the right dropdown

Public WithEvents cbx As MSForms.CheckBox
Public tbx As MSForms.TextBox

Private Sub cbx_Change()
tbx.Enabled = cbx.Value
End Sub

''Userform code

' two checkboxes named CheckBox1 & 2
' two textboxes named TextBox1 & 2

Dim arrClsCBoxEvnts(1 To 2) As Class1 ' or say clsCBxEvnts

Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To 2
Set arrClsCBoxEvnts(i) = New Class1
With arrClsCBoxEvnts(i)
Set .cbx = Me.Controls("CheckBox" & i)
Set .tbx = Me.Controls("TextBox" & i)
.tbx.Enabled = .cbx.Value
End With
Next
End Sub

Regards,
Peter T

"fedude" wrote in message
...
Joel,

Is there a generic form change event that I can catch in a routine that

then
loops through the checkbox controls to see if they've changed?

"Joel" wrote:

Each check box must have a unique function. But all of the routines can

have
one instruction which call a common function.






 
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
Form Click event... John Keith[_2_] Excel Programming 1 June 19th 07 05:40 PM
Click event for checkbox from Forms toolbar Carolyn Excel Discussion (Misc queries) 6 September 11th 06 08:16 PM
Passing CheckBox Value from Click Event to Main Macro ExcelMonkey[_190_] Excel Programming 2 February 1st 05 05:47 PM
Click Checkbox Event Montana DOJ Help Desk Excel Programming 4 November 11th 04 04:25 AM
Assigning click event to OleObjects checkbox Jim McLeod Excel Programming 5 April 20th 04 07:02 PM


All times are GMT +1. The time now is 04:08 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"