ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Generic Event Handler Hanging. Need help (https://www.excelbanter.com/excel-programming/411882-generic-event-handler-hanging-need-help.html)

fedude

Generic Event Handler Hanging. Need help
 
I have a form that has a lot of checkboxes on it. To make things simple I
used a generic event handler technique that I learned about on this forum.
I've included the code for my event handler below.

Now I want to pop-up another form when one of these checkboxes are selected
(firing off the event handler). Every time I insert code in the event
handler to show the other form, Excel hangs chewing up 100% of the CPU. I
cannot figure out what's going on.

My end goal is to pop-up annother simple form to collect two pieces of
information and then pass it back to the main form when the second form is
unloaded. I'm not really sure the best way to pass data between forms
either.

Does anyone have any ideas how to do this or what I'm doing wrong?


---------- Checkbox Event Handler --------------------
Public WithEvents BoxGroup As MSForms.CheckBox

Private Sub BoxGroup_Click()
Dim Player As String
Dim iCheckbox As MSForms.CheckBox
Dim iLabel As MSForms.Label
Dim iTextbox As MSForms.TextBox

Player = Right(BoxGroup.Name, 4)
Set iCheckbox = ScoresInputForm.Controls("Q" & Player)
Set iLabel = ScoresInputForm.Controls("L" & Player)
Set iTextbox = ScoresInputForm.Controls("S" & Player)


If BoxGroup.Value = True Then
' Disable entering this week's scores for this player
iTextbox.Value = ""
iLabel.Tag = iLabel.Caption
iLabel.Caption = "Substitute"
Userform1.Show ' <= It hangs here
iTextbox.Enabled = False
iTextbox.BackColor = &H8000000B
Else
' Re-eanble entering score for this player
iLabel.Caption = iLabel.Tag
iTextbox.Enabled = True
iTextbox.BackColor = &H80000005
End If

End Sub



All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com