Add a line to your Exit code
Add a SendKeys line as shown to send the curser back to the textbox.
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox6.Value = "" Then
MsgBox "A LOCATION MUST BE ENTERED."
SendKeys "+{TAB}" ' This goes back to TextBox6
End If
End Sub
As for the Cancel button problem, if you are in TextBox6 and you click the Cancel button, you are exiting the textbox which means the exit macro code for TextBox6 will be executed. Maybe the check for textbox6 should be put in the next focused object, (TextBox7 ?) on the Enter macro. The SendKeys will send it back to TextBox6 after the msgbox. I usually put that kind of check on the "OK" or "UPDATE" button and set the focus to the object that needs the information.
Add a line of code to tab back to the textbox as:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox6.Value = "" Then
MsgBox "A LOCATION MUST BE ENTERED."
SendKeys "+{TAB}"
End If
End Sub
As for the Cancel button problem, when you click the button, you are exiting fron that text box and so the exit code is executed. One solution is to move that code to the next object (TextBox7 ?) on the Enter funtion. I usually add this kind of check at the "UPDATE" button, check all required fields and set the focus to the textbox that is missing data. Hope this helps. Rick E
I added a check macro called by the Next and OK buttons
Via Vlookup formula you cant lookup data must be visable (OPEN BOOKS), i understand that VBA can look in closed SS but thast beyond me, lets hope a programmer catches this post.