I'm trying to extrapolate the phone number present in each url listed in sheet 1 column "A" of excel.
Unfortunately, I don't have the right knowledge to do it.
I insert some of the code that could be used.
Unfortunately, I don't have the right knowledge to do it.
I insert some of the code that could be used.
VBA Code:
Private Sub CommandButton1_Click()
Dim wb As Workbook
Dim x As Variant
Dim i, j, k, l As Integer
Dim r As Long, LR As Long
Dim wsSheet As Worksheet, links As Variant, ie As Object, link As Variant
Dim rw As Long
i = 2
k = 2
l = 1
'SCEET2 as sheet with URL
Set wb = ThisWorkbook
Set wsSheet = wb.Sheets("Sheet1")
'Set IE = InternetExplorer
Set ie = CreateObject("InternetExplorer.Application")
rw = wsSheet.Cells(wsSheet.Rows.Count, "A").End(xlUp).Row
links = wsSheet.Range("A2:A" & rw)
'IE Open Time per page 5sec and check links on Sheet2 Column A
With ie
.Visible = True
Application.Wait (Now + TimeValue("00:00:0"))
For Each link In links
.navigate (link)
While .Busy Or .readyState <> 4: DoEvents: Wend
Dim doc As HTMLDocument
Set doc = ie.document
Dim dd As Variant
On Error Resume Next
'variable for document or data which need to be extracted out of webpage
'+++++++++ Extract Data from URL++++++++
''Extract elements
'If doc.getElementsByClassName("_50f4")(2) Is Nothing Then
' wsSheet.Cells(Sheet1.Cells(Sheet1.Rows.Count, "B").End(xlUp).Row + 1, "B").Value = "-"
' Else
' dd = doc.getElementsByClassName("_50f4")(2).innerText
' Sheet1.Cells(Sheet1.Cells(Sheet1.Rows.Count, "B").End(xlUp).Row + 1, "B").Value = dd
'End If
[B]'++++++++++++++++ I need Phone number code here +++++++++++++++++++++++++++[/B]
[B]'++++++++++++++++ End Number search Code +++++++++++++++++++++++++++++++[/B]
On Error Resume Next
'Deletes duplicates in column A Sheet1
'Columns(2).RemoveDuplicates Columns:=Array(1)
' Columns(3).RemoveDuplicates Columns:=Array(1)
'navigate links
Next link
'Close IE Browser
.Quit
End With
Set ie = Nothing
End Sub