+ Reply to Thread
Results 1 to 7 of 7

Email Validation Macro

  1. #1
    Registered User
    Join Date
    09-16-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Email Validation Macro

    Hi Everyone,

    I'd like to create a macro that validates if emails are properly entered in column A (minus the column heading) once the emails have already been entered. There should only be one email per cell, the email should be in proper format (which includes no spaces and unwanted characters), and all the cells with a mistake in them should be highlighted in orange and give one error message for all. Preferably I'd like this macro to be activated by a button in the active sheet.

    Thank you for your time and I'll appreciate all the help I can get.

    Regards,
    DrNo1

  2. #2
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Email Validation Macro

    Please see the attached workbook. You need to set a reference to "Microsoft VBSript Regular Expressions 5.5" for this to work.

    Since Excel recognizes email addresses and creates a "mailto:" hyperlink there may be a method to use this to determine if an email address exists. I don't know though.
    Attached Files Attached Files
    Last edited by g8r777; 10-10-2012 at 11:04 PM.

  3. #3
    Registered User
    Join Date
    09-16-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Email Validation Macro

    Thanks g8r777, the validation works! Could you possibly amend the macro so that it doesn't check the column heading and that i can activate it using a button found on the active sheet?

    Again thank you!

  4. #4
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Email Validation Macro

    See the attached file.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-16-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Email Validation Macro

    This is exactly what I was looking for and I learned so much from your code!

    Thank you very much!

  6. #6
    Registered User
    Join Date
    03-25-2023
    Location
    Morpeth UK
    MS-Off Ver
    Microsoft 365
    Posts
    1

    Re: Email Validation Macro

    further to the excellent advice above, I would also like some help in working out the syntex for email validation in a userform textbox

    thank you in advance

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: Email Validation Macro

    Quote Originally Posted by Terry _007 View Post
    further to the excellent advice above, I would also like some help in working out the syntex for email validation in a userform textbox

    thank you in advance
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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