Sorry about that.
Sorry about that.
Hello cfaust,
Welcome to the Forum!
This macro will highlight any invalid email addresses in column "A" start with cell "A2". I am assuming you have a header in in "A1".
![]()
Sub ValidEmail() Dim Cel As Range Dim Rng As Range Dim RngEnd As Range Set Rng = Range("A2") Set RngEnd = Cells(Rows.Count, Rng.Column).End(xlUp) If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Range(Rng, RngEnd) For Each Cel In Rng If Not (Cel Like Like "[!.]*?[!.]@[!-]?*?.?*[!-]") Then Cel.Interior.ColorIndex = 6 End If Next Cel End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thanks a lot for the help and the above code you are right about having a header so starting at A2 is perfect.
When I run the macro I get a syntax error on the line.
![]()
If Not (Cel Like Like "[!.]*?[!.]@[!-]?*?.?*[!-]") Then
I am trying to figure out why but I thought I would post it while I attempt to debug.
Hello cfaust,
If only I could type. Remove one of the "Like" statements in the line.
![]()
If Not (Cel Like "[!.]*?[!.]@[!-]?*?.?*[!-]") Then
That was it thanks a lot for your help it works perfectly.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks