ComboBox_Click event problem
Yes, it was a typo. It should have been OldANNo in both places and was in
the actual code.
However, I went through the code and cleaned it up some, using only one
variable (SkipEvent, set to True at every point the click event might be
trigggered unnecessarily). I also replaced the "Exit Sub" commands with
"GoTo " Line label (just before the End Sub). Finally just before the line
of code that triggered the event, I added Application.EnableEvents = False
(and followed the code with Application.EnableEvents = True). This
combination of changes solved the problem.
Bert
"JLGWhiz" wrote in message
...
Unless one of these was a typo in the posting only, then it could be your
problem.
OldANNo = NamesRows(ActiveNameNo)
Call AddStar(OldASNo)
It looks like you are attempting to pass the variable Call
InsertComment((InsPt), (i))
as OldASNo,
which won't work.
"Bert" wrote:
Here's the code for the click event and the Add asterik subroutine.
This is the Click event code:
Private Sub ComboBox2_Click()
' Selects name to do next
If CB2C = True Then
CB2C = False
Exit Sub
End If
If Redo1 Then
Redo1 = False
Exit Sub
End If
If ReDo = True Then
Redo1 = True
UserForm1.ComboBox2.ListIndex = ActiveNameNo - 1
Exit Sub
End If
Call UF1_to_Student_Data(StudentRows(ActiveNameNo)) ' writes all data
to
the proper name's entry
OldANNo = NamesRows(ActiveNameNo)
ActiveNameNo = UserForm1.ComboBox2.ListIndex + 1
Call PopulateForm(NamesRows(ActiveNameNo))
Call SetTimer(1000)
Call AddStar(OldASNo)
End Sub
This is the asterisk-writing code that causes the loop back to
ComboBox2_Click which called it in the first place.
Sub AddStar(s)
'add asterik if data is complete
v1 = Worksheets("Name_Data").Cells(s, LstNmClm) & ", " &
Worksheets("Name_Data").Cells(s, FstNmClm)
v2 = Worksheets("Name_Data").Cells(s, LstNmClm) & ", " &
Worksheets("Name_Data").Cells(s, NckNmClm)
If IsDone(s) Then
With UserForm1.ComboBox2
For B = 0 To .ListCount - 1
If .List(B, 1) = v1 Or .List(B, 1) = v2 Then
CB2C = True ' exit out of the ComboBox2_Click subroutine as
soon
as you get there.
.List(B, 0) = "*"
Exit Sub
End If
Next
End With
End If
CB2C = False
End Sub
|