+ Reply to Thread
Results 1 to 9 of 9

Create Error Message for Data Entry Validation

  1. #1
    Registered User
    Join Date
    02-10-2020
    Location
    saudi arabia
    MS-Off Ver
    office 10
    Posts
    13

    Create Error Message for Data Entry Validation

    I need VBA code, if A1 is empty, when I try to enter in cell A2, error message should appear like Enter A1 first.

    Thanks...
    Last edited by AliGW; 02-25-2020 at 09:18 AM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Error Message

    In the VBA editor, on the left you will see the excel objects. Double-click on the sheet name that you want to be affected, and then paste this code:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    02-10-2020
    Location
    saudi arabia
    MS-Off Ver
    office 10
    Posts
    13

    Re: Error Message

    Thanks Mr. Arkadi for your help. But there is debug Error.

    Attachment 664427
    Last edited by AliGW; 02-25-2020 at 09:18 AM. Reason: Please don't quote unnecessarily!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,323

    Re: Create Error Message for Data Entry Validation

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. As you are new, I have done it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Create Error Message for Data Entry Validation

    HAJANISHA, I can't see that image... so I don't know what the error is

  6. #6
    Registered User
    Join Date
    02-10-2020
    Location
    saudi arabia
    MS-Off Ver
    office 10
    Posts
    13

    Re: Create Error Message for Data Entry Validation

    Run-time error '1004':
    Method 'Undo' of object'_Application'failed

    This is the error message

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Create Error Message for Data Entry Validation

    Not sure why without looking at the file, but try changing "Application.Undo" to Target.Value = vbNullString

  8. #8
    Registered User
    Join Date
    02-10-2020
    Location
    saudi arabia
    MS-Off Ver
    office 10
    Posts
    13

    Re: Create Error Message for Data Entry Validation

    Thanks A lot. works perfectly.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Create Error Message for Data Entry Validation

    That's great Please remember to mark the thread as solved if you are satisfied? Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Replace error message with text message
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2017, 02:37 AM
  2. An error message on open - a totally blank VBA message box
    By Mr_Tigas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-05-2013, 11:29 AM
  3. Error Message For Function Procedure WITHOUT using a message box
    By bmr8002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 02:01 PM
  4. Replacing run time error message with a different message
    By penny in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-14-2009, 10:51 AM
  5. [SOLVED] replace VBA run-time error message with custom message
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-14-2006, 11:05 AM
  6. changing the message in an error message
    By The Villages DA in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-18-2005, 01:34 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1