Data validation

  • Thread starter Scott.Harris.mt
  • Start date
S

Scott.Harris.mt

Does anyone know how to have a text field (not a list) that will pop
an error message if the field is blank?
 
C

CorporateQAinTX

Data < Validation < Allow:Text Length < Data: greater than < Minimum: 0 <
uncheck Ignore Blank.

You can use the Input Message tab and Error Alert Tab to inform the users of
what they need to do and how to fix their error. It works. I've been using
the validations for weeks to make sure my own people do what they're supposed
to with my spreadsheets.

QA Techie
 
J

JP

You should really be more specific, it depends on what you are trying
to do. You could set up data validation on a cell, choose "Custom"
from the Allow dropdown, put "=NOT(ISBLANK(A1))" in the formula box,
and uncheck "Ignore Blank". Then if someone edits A1 and tries to
backspace over what is already there (leaving the cell blank), they
get an error message.

Or if you were creating a userform, you could write some validation
that checks the value of a text box. If it was blank, display error
msg. For example, if you had a userform with a text box named
TextBox1, this code would show an error message if you clicked on it
and then clicked away without typing anything.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Value = "" Then
Cancel = True
MsgBox "You forgot to type something!", vbCritical
End If
End Sub


HTH,
JP
 

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

Top