View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
ljCharlie[_4_] ljCharlie[_4_] is offline
external usenet poster
 
Posts: 1
Default Formula to check email address


Bob Phillips Wrote:
Add this VBA function


'-----------------------------------------------------------------
Public Function ValidEmail(Adress As String) As Boolean
'-----------------------------------------------------------------
Dim oRegEx As Object
Set oRegEx = CreateObject("VBScript.RegExp")
With oRegEx
.Pattern =
"^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"
' .Pattern = "^(\w+\.)*(\w+)@(\w+\.)+([a-zA-Z]{2,4})$"
ValidEmail = .Test(Adress)
End With
Set oRegEx = Nothing
End Function


and use like

)



How do I modify the code so that I can specify an email column?




--
ljCharlie