I have an excel worksheet database from which VBA userform routine loads each record. I want the user to make a listbox selection on each record which is recorded back to the Excel worksheet before allowing movement to the next record. I want to prompt the user with a message that a selection must be made before moving to the next record. I am new to VBA and everything I try ends up in an infinite loop when responding to the message. The Subs are shown below. Please help and thank you for your assistance. The code is below and the file is attached.
Private Sub NextRec_Click()
lastrow = 15
currentrow = currentrow + 1
ListBox1.ListIndex = -1
If currentrow = lastrow Then
MsgBox "You have answered the last question"
Dom.Text = Cells(currentrow, 1)
AssessText.Text = Cells(currentrow, 2)
Subcat.Text = Cells(currentrow, 3)
Maturity.Text = Cells(currentrow, 4)
Decstate.Text = Cells(currentrow, 5)
Cells(currentrow, 6) = ListBox1.Text
If ListBox1.ListIndex = -1 Then
MsgBox ("You must make a selection before proceeding")