Nelson78
Well-known Member
- Joined
- Sep 11, 2017
- Messages
- 526
- Office Version
- 2007
Hello everybody.
I succeeded to import an entire table from a web page.
But my need is importing just a single data and writing it in Worksheets("General").Range("A1")
The table has 27 columns and 21 rows: how can I import the value with the following coordinates:
column 11
row 4
Thank's in advance.
I succeeded to import an entire table from a web page.
But my need is importing just a single data and writing it in Worksheets("General").Range("A1")
The table has 27 columns and 21 rows: how can I import the value with the following coordinates:
column 11
row 4
Code:
Dim tbls, tbl, trs, tr, tds, td, r, c
Set tbls = IE.document.getElementsByTagName("table")
For r = 0 To tbls.Length - 1
Debug.Print r, tbls(r).Rows.Length
Next r
Set tbl = IE.document.getElementsByTagName("table")(8)
Set trs = tbl.getElementsByTagName("tr")
For r = 0 To trs.Length - 1
Set tds = trs(r).getElementsByTagName("td")
If tds.Length = 0 Then Set tds = trs(r).getElementsByTagName("th")
For c = 0 To tds.Length - 1
Worksheets("General").Range("A1").Offset(r, c).Value = tds(c).innerText
Next c
Next r
Thank's in advance.