I have a userform which a user has to input a loan number. If they input the loan number in the textbox, it feeds to cell A2 of the worksheet called UserformPractice.
If the user does not input anything in the textbox, a message box appears reminding them to input the loan number.
I need help with my code so that once this message box appears, it takes them back to the userform so that can put in the loan number.
Additionally, if there was any possibility to not allow the user to proceed with using the spreadsheet unless the loan number is put in the textbox, that would be great.
I'm sure I would have to insert another button titled "ExitExcel" to initiate
that process.
Any help would be great.
Here is my code.
Option Explicit
Private Sub cmbSubmit_Click()
Dim Response1 As VbMsgBoxResult
Dim ws As Worksheet
Set ws = Worksheets("UserformPractice")
ws.Range("A2").Select
Do Until ActiveCell.Value <> ""
If txtLoanNumber.Value <> "" Then
ws.Range("A2") = ""
ws.Range("A2").Value = Me.txtLoanNumber.Value
ElseIf txtLoanNumber.Value = "" Then
Response1 = MsgBox("Please Input The Loan # ", vbOKOnly, "Missing Loan Information")
If Response1 = vbOKOnly Then
End If
Loop
End If
Unload Me
End Sub
Private Sub txtLoanNumber_Change()
End Sub
If the user does not input anything in the textbox, a message box appears reminding them to input the loan number.
I need help with my code so that once this message box appears, it takes them back to the userform so that can put in the loan number.
Additionally, if there was any possibility to not allow the user to proceed with using the spreadsheet unless the loan number is put in the textbox, that would be great.
I'm sure I would have to insert another button titled "ExitExcel" to initiate
that process.
Any help would be great.
Here is my code.
Option Explicit
Private Sub cmbSubmit_Click()
Dim Response1 As VbMsgBoxResult
Dim ws As Worksheet
Set ws = Worksheets("UserformPractice")
ws.Range("A2").Select
Do Until ActiveCell.Value <> ""
If txtLoanNumber.Value <> "" Then
ws.Range("A2") = ""
ws.Range("A2").Value = Me.txtLoanNumber.Value
ElseIf txtLoanNumber.Value = "" Then
Response1 = MsgBox("Please Input The Loan # ", vbOKOnly, "Missing Loan Information")
If Response1 = vbOKOnly Then
End If
Loop
End If
Unload Me
End Sub
Private Sub txtLoanNumber_Change()
End Sub