Display error msg when cells left blank

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas
 
Jas said:
I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas

Hello

When the commandbutton is clicked that tranfers your data to your sheet you
need to test the textbox items that you want to be filled e.g.

commandbutton1_click()

If textbox1.value = "" then
msgbox "You need to fill in your name"
exit sub
end if

If the textbox contains data then it will be ignored, you may need to repeat
this process if you have more than one box

(e-mail address removed)
 
Sorry ive misinterpreted your post, please ignore my answer
 
It would be a worksheet change event but the code doesnt seem to work:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Range(C3).Value = "" Then
Application.EnableEvents = False
MsgBox "This is a mandatory field. Please enter you name."
End If
Application.EnableEvents = True
End sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top