I am looking for a code that will generate a message box if there are values in either TextBox2 or TextBox3 but nothing in TextBox1. If this happens I would also like it to stop the sub.
This is my current code that will generate a message box but only if there is a value in TextBox3 and nothing in TextBox1. It doesn't seem to check TextBox2. Further, once I click Ok on the message box it will forward the value in TextBox3 to the worksheet, which I don't want.
Private Sub SubmitCommandButtom_Click() 'Error Message if Unit Number is not Typed in If Len(TextBox1) = "" And Len(TextBox2) > 0 Or Len(TextBox3) > 0 Then MsgBox "Unit Number must be entered to continue!" End If 'Inserting original unit values into workbook Sheets("Uneven Split Job Aid").Range("A2") = TextBox1.Value Sheets("Uneven Split Job Aid").Range("B2") = TextBox2.Value Sheets("Uneven Split Job Aid").Range("C2") = TextBox3.Value
Thanks for any help!