|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub cc()
Set oDoc = CreateObject("htmlfile")
Cells.ClearContents
With CreateObject("MsXml2.xmlhttp")
.Open "GET", "http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2016/index.html", False
.setrequestheader "Connection", "Keep-Alive"
.Send
oDoc.body.innerHTML = StrConv(.responsebody, vbUnicode)
Set r = oDoc.All.Tags("table")(4).Rows
Range("A1") = r(2).Cells(0).innertext
For i = 3 To 6
For j = 0 To r(i).Cells.Length - 1
Cells(i - 1, j + 1) = r(i).Cells(j).innertext
Next j
Next i
End With
End Sub
|
|