1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Sub Fetch_TableData()
Dim http As New XMLHTTP60, html As New HTMLDocument
Dim posts As Object, post As Object, elem As Object
Dim row, col, destRow, destCol As Long
With http
.Open "GET", "https://www.zonebourse.com/DANONE-4634/fondamentaux/", False
.send
html.body.innerHTML = .responseText
End With
Set posts = html.getElementsByClassName("BordCollapseYear")(0)
For Each post In posts.Rows
If row <> 0 And row <> 12 Then
For Each elem In post.Cells
If col <> 0 Then
destCol = col: col = col + 1
Select Case row
Case 2, 3, 4, 5, 6, 8, 9, 11
Cells(destRow, destCol).NumberFormat = "#.00": Cells(destRow, destCol) = CSng(elem.innerText)
Case Else
Cells(destRow, destCol).NumberFormat = "@": Cells(destRow, destCol) = elem.innerText
End Select
Else
col = col + 1
End If
Next elem
End If
col = 0
row = row + 1: destRow = row
Next post
End Sub |
Partager