Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Extracting email addresses from hyperlinks.

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Extracting email addresses from hyperlinks.

Saved from a previous post:

Are the hyperlinks inserted via Insert|Hyperlink?

If yes:

You can use a User defined function to retrieve the link.

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

=========
After you extract your email addresses, you could select that column B1:B500 and
edit|copy followed by edit|paste special values

Then edit|replace
what: mailto:
with: (leave blank)
replace all

or just use:
=mid(geturl(a1),8,255)
and leave it a formula.


Brossyg wrote:

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Extracting email addresses from hyperlinks.

Unfortunately, this returns #NAME?. No, the cells copied from the html page
were simply Select All/Copy on the html page (display page, not the code) and
then Pasted into the Excel sheet. The links work pefectly as links once in
the Excel sheet.

Also, if I highlight one and right click on Edit Hyperlink, all the info is
there correctly.

Any other possibilities?

"Dave Peterson" wrote:

Saved from a previous post:

Are the hyperlinks inserted via Insert|Hyperlink?

If yes:

You can use a User defined function to retrieve the link.

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

=========
After you extract your email addresses, you could select that column B1:B500 and
edit|copy followed by edit|paste special values

Then edit|replace
what: mailto:
with: (leave blank)
replace all

or just use:
=mid(geturl(a1),8,255)
and leave it a formula.


Brossyg wrote:

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Extracting email addresses from hyperlinks.

I'm betting that you didn't put the code in a general module. Try following
those instructions once more.

Brossyg wrote:

Unfortunately, this returns #NAME?. No, the cells copied from the html page
were simply Select All/Copy on the html page (display page, not the code) and
then Pasted into the Excel sheet. The links work pefectly as links once in
the Excel sheet.

Also, if I highlight one and right click on Edit Hyperlink, all the info is
there correctly.

Any other possibilities?

"Dave Peterson" wrote:

Saved from a previous post:

Are the hyperlinks inserted via Insert|Hyperlink?

If yes:

You can use a User defined function to retrieve the link.

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

=========
After you extract your email addresses, you could select that column B1:B500 and
edit|copy followed by edit|paste special values

Then edit|replace
what: mailto:
with: (leave blank)
replace all

or just use:
=mid(geturl(a1),8,255)
and leave it a formula.


Brossyg wrote:

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Extracting email addresses from hyperlinks.

Your awesome...thank you. I had put it in the sheet area...right clicking on
the sheet tab. It works now.

Thank you.

"Dave Peterson" wrote:

I'm betting that you didn't put the code in a general module. Try following
those instructions once more.

Brossyg wrote:

Unfortunately, this returns #NAME?. No, the cells copied from the html page
were simply Select All/Copy on the html page (display page, not the code) and
then Pasted into the Excel sheet. The links work pefectly as links once in
the Excel sheet.

Also, if I highlight one and right click on Edit Hyperlink, all the info is
there correctly.

Any other possibilities?

"Dave Peterson" wrote:

Saved from a previous post:

Are the hyperlinks inserted via Insert|Hyperlink?

If yes:

You can use a User defined function to retrieve the link.

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

=========
After you extract your email addresses, you could select that column B1:B500 and
edit|copy followed by edit|paste special values

Then edit|replace
what: mailto:
with: (leave blank)
replace all

or just use:
=mid(geturl(a1),8,255)
and leave it a formula.


Brossyg wrote:

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Extracting email addresses from hyperlinks.

This post was very helpful. Thank you for sharing.

"Brossyg" wrote:

I copied several hundred email address hyperlinks from an html page into a
spreadsheet. They all showed text as "Click her to email" on the html page.
They copied correctly as hyperlink "mailto" links, but the text in the excel
field is still "Click her to email". The email links span A1 - A500. I am
trying to find a way to show the email address only in B1 - B500. How do i
do this?

Brossyg

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
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM
How do I export email addresses from Excel to Outlook? JasonLi Excel Discussion (Misc queries) 2 May 22nd 06 03:51 PM
make XL stop interpreting email addresses as highlighted links? John Smith Excel Discussion (Misc queries) 5 April 1st 06 03:09 PM
Finding email addresses in cells Joey Excel Worksheet Functions 19 March 18th 06 12:29 AM
Format email addresses Unknown Excel Discussion (Misc queries) 5 November 27th 05 01:44 AM


All times are GMT +1. The time now is 10:19 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"