Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: form validation

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Ok second question of the day.

    Can someone tell me the code I need to validate form entry.
    I want a message box to appear if someone attempts to submit details(by clicking a button) if they have left a textbox empty (or put the wrong info in).

    Thanks
    Andy

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    There's many ways to do this. As a starter you might try stuff like: -

    If TextBox1.Text = "" Then MsgBox ....

    If Not IsNumeric(TextBox1.Text) Then MsgBox ...

    MaxValue = 1000 ' As an example
    If TextBox1.Text > MaxValue Then MsgBox ...

    Note you can also restrict what people can actually type into a textbox in the first place with the TextBox_Change() Event.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •