Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default Test for email addresses

I have a large (~10,000) list of former clients in an excel file that was
created when I pulled a report from my third party software. I've contracted
with a newsletter company to help stay in touch with them. The newsletter
company charges by entry so I need to delete any rows that aren't email
addresses. I've already found the marco that deletes duplicate entries, and I
can easily sort to get rid of entries with no email address, now I need some
way to delete entries that have something other than an email address in the
"email address" column.

The answer could be several things: a helper column that tests for
wildcard@wildcard, or a macro that tests and deletes rows. I haven't been
able to get anything to work yet. Any help is appreciated.

Regards,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Test for email addresses

Here is a function that tests it


'-----------------------------------------------------------------
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


just add =ValidEmail(A1) in B1 say.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
I have a large (~10,000) list of former clients in an excel file that was
created when I pulled a report from my third party software. I've

contracted
with a newsletter company to help stay in touch with them. The newsletter
company charges by entry so I need to delete any rows that aren't email
addresses. I've already found the marco that deletes duplicate entries,

and I
can easily sort to get rid of entries with no email address, now I need

some
way to delete entries that have something other than an email address in

the
"email address" column.

The answer could be several things: a helper column that tests for
wildcard@wildcard, or a macro that tests and deletes rows. I haven't been
able to get anything to work yet. Any help is appreciated.

Regards,



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default Test for email addresses

Ok, I'm lost. I copied your code, right-clicked my tab name and then pasted it.

What do you mean, "just add =ValidEmail(A1) in B1 say."
Where do I add it?

Thanks,


"Bob Phillips" wrote:

Here is a function that tests it


'-----------------------------------------------------------------
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


just add =ValidEmail(A1) in B1 say.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
I have a large (~10,000) list of former clients in an excel file that was
created when I pulled a report from my third party software. I've

contracted
with a newsletter company to help stay in touch with them. The newsletter
company charges by entry so I need to delete any rows that aren't email
addresses. I've already found the marco that deletes duplicate entries,

and I
can easily sort to get rid of entries with no email address, now I need

some
way to delete entries that have something other than an email address in

the
"email address" column.

The answer could be several things: a helper column that tests for
wildcard@wildcard, or a macro that tests and deletes rows. I haven't been
able to get anything to work yet. Any help is appreciated.

Regards,




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Test for email addresses

You shouldn't store it in the sheet code module, but in a standard code
module, it is a UDF.

You use it in the worksheet by, assuming that the address are in column A,
in B1 put =ValidEmail(A1) and copy down, then filter column B by False
and delete the visible rows.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
Ok, I'm lost. I copied your code, right-clicked my tab name and then

pasted it.

What do you mean, "just add =ValidEmail(A1) in B1 say."
Where do I add it?

Thanks,


"Bob Phillips" wrote:

Here is a function that tests it


'-----------------------------------------------------------------
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


just add =ValidEmail(A1) in B1 say.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
I have a large (~10,000) list of former clients in an excel file that

was
created when I pulled a report from my third party software. I've

contracted
with a newsletter company to help stay in touch with them. The

newsletter
company charges by entry so I need to delete any rows that aren't

email
addresses. I've already found the marco that deletes duplicate

entries,
and I
can easily sort to get rid of entries with no email address, now I

need
some
way to delete entries that have something other than an email address

in
the
"email address" column.

The answer could be several things: a helper column that tests for
wildcard@wildcard, or a macro that tests and deletes rows. I haven't

been
able to get anything to work yet. Any help is appreciated.

Regards,






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default Test for email addresses

That did it. Thanks

"Bob Phillips" wrote:

You shouldn't store it in the sheet code module, but in a standard code
module, it is a UDF.

You use it in the worksheet by, assuming that the address are in column A,
in B1 put =ValidEmail(A1) and copy down, then filter column B by False
and delete the visible rows.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
Ok, I'm lost. I copied your code, right-clicked my tab name and then

pasted it.

What do you mean, "just add =ValidEmail(A1) in B1 say."
Where do I add it?

Thanks,


"Bob Phillips" wrote:

Here is a function that tests it


'-----------------------------------------------------------------
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


just add =ValidEmail(A1) in B1 say.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sb1920alk" wrote in message
...
I have a large (~10,000) list of former clients in an excel file that

was
created when I pulled a report from my third party software. I've
contracted
with a newsletter company to help stay in touch with them. The

newsletter
company charges by entry so I need to delete any rows that aren't

email
addresses. I've already found the marco that deletes duplicate

entries,
and I
can easily sort to get rid of entries with no email address, now I

need
some
way to delete entries that have something other than an email address

in
the
"email address" column.

The answer could be several things: a helper column that tests for
wildcard@wildcard, or a macro that tests and deletes rows. I haven't

been
able to get anything to work yet. Any help is appreciated.

Regards,






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help finding non-duplicate email addresses... Greg Excel Discussion (Misc queries) 16 December 19th 07 11:51 AM
Help needed...test score statistics Justin Excel Discussion (Misc queries) 8 July 8th 06 01:35 AM
comparing test scores over a few years Justin Excel Discussion (Misc queries) 0 July 3rd 06 01:39 PM
copy/convert column email addresses Hyperlink "mailto:" excel97 daleman101 Excel Discussion (Misc queries) 3 November 3rd 05 01:21 PM
Copy Excel email addresses to GroupWise Sherry Excel Discussion (Misc queries) 0 July 14th 05 08:20 PM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"