Hello there !!!
I am writting because I am having issues with identifying how to have a message box pop up whe the user selects an option in the userform that is already in the database. I have a userform for a tutor center that needs to identify based on the values entered on 4 TextBoxes if that test the student has already completed.
What I need is a message box to pop up when the teacher selects an option that the student already has passed. The values to search are ComboBox2 (student name), ComboBox7 (module name), ComboBox9 (belt), and ComboBox8 (level), which can be found in the database in Column L (Helper Column) and verify if in Column M the status is Pass. This is the code I have at the moment, but it does not pop up with the message.
- Dim ws As Worksheet
- Dim duplStr As String
- Dim LastRow As Long
- Dim i As Integer
- Set ws = Worksheets("DataBase")
- LastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
- duplStr = ComboBox2.Text & ComboBox7.Text & ComboBox9.Text & ComboBox8.Text
- For i = 2 To LastRow
- If ws.Cells(i, 12).Value = duplStr And ws.Cells(1, 13).Value = "Pass" Then
- MsgBox "Student already completed and passed this level."
- Exit Sub
- End If
- Next i
Can someone help me out with this. I believe its simple, but not understand why is not working.