I apologise if this is a repost but I have been searching for a while and cannot find a solution to my problem
I have created a userform in which there is a combo box and several text boxes these boxes input data into corresponding cells depending on the option selected in the combo box
the problem I have is that when a text box is blank the data is still input into the spreadsheet leaving that cell blank
I wish to write into the code that if a text box is blank the data entry is cancelled, focus is set onto that box and an error box comes up
I have included my code below to show what I have at the moment
error in message box
If txtNo.Value = "" Then
MsgBox "You must input a drawing number"
txtNo.SetFocus
End If
'clear input controls.
Me.txtNo.Value = ""
'set focus on drawing box
txtNo.SetFocus
End Sub
Bookmarks