I have a working InputBox code that uses a 'Do Until' loop to fill in new Data against each name listed in Column B.
What I'm trying to do now is stop the user from simply keep hitting the 'Enter' key to move to next input. And subsequent next Sub.
I have it working with a MessageBox option showing after the final entry has been made, just to check if all OK.
What I'm now trying to do is introduce a Modeless Userform that needs to be controlled by a click, instead of a static MsgBox, as this will enable them to access the worksheet and check/scroll through the long list of Data, before moving on.
But I don't know what code lines I need to enter behind the 2 Userforms CommandButtons to either re-start the loop or how to get out of it and move onto the next sub.
At the moment I just have UserForm7.Show as a replacement for the "iRet = MsgBox" lines.
The codes I've put on the two Userform buttons at the moment are as follows:
But this doesn't work.
Any help appreciated.
What I'm trying to do now is stop the user from simply keep hitting the 'Enter' key to move to next input. And subsequent next Sub.
I have it working with a MessageBox option showing after the final entry has been made, just to check if all OK.
Code:
MyNewData = "x" ' Dummy value to keep loop alive
Do Until MyNewData = ""
ListRow = 10: ListColumn = 2: NewDataColumn = 10: NewDataColumn2 = 37
While ActiveSheet.Cells(ListRow, ListColumn) <> ""
MyNewData = InputBox("Enter the Details for:- " & vbNewLine & vbNewLine & ActiveSheet.Cells(ListRow, ListColumn), _
"Add Scores", ActiveSheet.Cells(ListRow, NewDataColumn)) 'Get input
If MyNewData <> "" Then
ActiveSheet.Cells(ListRow, NewDataColumn) = MyNewData 'If input is not empty, use the input
ActiveSheet.Cells(ListRow, NewDataColumn2) = MyNewData
Else: ActiveSheet.Cells(ListRow, NewDataColumn) = ""
End If
ListRow = ListRow + 1
Wend
iRet = MsgBox("Are you happy with the Data entered?" & vbNewLine & vbNewLine _
& "Click 'Yes' to Move on." & vbNewLine _
& "Or" & vbNewLine _
& "Click 'No' to Re-enter the Data", vbYesNo + vbQuestion, "Check Scores")
If iRet = vbYes Then MyNewData = "" ' User wants to move on
If iRet = vbNo Then MyNewData = "x" ' User wants to go again so keep the loop alive
Loop
'Move to Next Sub
What I'm now trying to do is introduce a Modeless Userform that needs to be controlled by a click, instead of a static MsgBox, as this will enable them to access the worksheet and check/scroll through the long list of Data, before moving on.
But I don't know what code lines I need to enter behind the 2 Userforms CommandButtons to either re-start the loop or how to get out of it and move onto the next sub.
At the moment I just have UserForm7.Show as a replacement for the "iRet = MsgBox" lines.
The codes I've put on the two Userform buttons at the moment are as follows:
Code:
Private Sub CommandButton1_Click() ' Move On
MyNewData = ""
Unload Me
End Sub
Private Sub CommandButton2_Click() ' Go Back
MyNewData = "x"
Unload Me
End Sub
But this doesn't work.
Any help appreciated.