Forum Discussion
Need code to search email id from website links through excel
- nkd8477Sep 18, 2020Copper Contributor
NikolinoDE In excel sheet 1 column A will be website addresses and in column B will fetch e-mail id's of website addresses given A.
- NikolinoDESep 18, 2020Platinum Contributor
Maybe this will help you to create your own VBA code or everything as you wish.
Hyperlinks via VBA
With this macro all hyperlinks of a defined cell range can be read out. In this example, the macro scans column A and lists the results, i.e. all hyperlinks read in column B.Public Sub Hyperlink_niko () 'Read out the hyperlink address Dim hlink As Hyperlink i = 1 For Each hlink In Sheets (1) .Hyperlinks Sheets (1) .Cells (i, 2) .Value = hlink.Address i = i + 1 Next hlink End Sub
If the hyperlinks are mail addresses, the word mailto: is also automatically output. As a result, you will receive, for example, the email address of the hyperlink as follows: mailto: nikolino@excelsius.com
The following macro removes this addition and only outputs nikolino@excelsius.com as a hyperlink. The addition mailto: is removed.Public Sub Hyperlink_lino_mail address () Dim hlink As Hyperlink i = 1 'Read out the hyperlink address For Each hlink In Sheets (1) .Hyperlinks mail = hlink.Address mailneu = Right (mail, Len (mail) - 7) Sheets (1) .Cells (i, 2) .Value = mail new i = i + 1 Next hlink End Sub
With the help of the Right () function, this macro removes the addition "mailto:" from the read mail address.I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- nkd8477Sep 18, 2020Copper Contributor
NikolinoDE thanks but this is not i am looking for.
Example - i have site http://www.cnbc.com in Colum A in Sheet1.
i want that on click on button the macro code should run and should scan this above website and should search for e-mail id's in the page and when found it should paste it in column B in excel.