Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transfer Email addresses from spreadsheet to email address book | Excel Discussion (Misc queries) | |||
How do I export email addresses from Excel to Outlook? | Excel Discussion (Misc queries) | |||
make XL stop interpreting email addresses as highlighted links? | Excel Discussion (Misc queries) | |||
Finding email addresses in cells | Excel Worksheet Functions | |||
Format email addresses | Excel Discussion (Misc queries) |