|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 按钮1_Click()
- Dim url, html, n, p
- n = 2
- Cells.NumberFormatLocal = "@"
- For p = 5 To 6
- url = "http://www.okooo.com/zucai/shuju/zhishu/141" & Format(p, "00")
- Set html = CreateObject("htmlfile")
- With CreateObject("msxml2.xmlhttp")
- .Open "get", url, False
- .send
- html.body.innerhtml = StrConv(.responsebody, vbUnicode)
- Set tb = html.all.tags("table")(0).Rows
- For i = 1 To tb.Length - 1
- If Trim(CStr(tb(i).Cells(4).innertext)) = "2-0" Then
- n = n + 1
- For j = 1 To tb(i).Cells.Length - 1
- Cells(n, j + 1) = tb(i).Cells(j).innertext
- Next
- Cells(n, 1) = n - 2
- End If
- Next
- End With
- Next
- End Sub
- Sub 按钮2_Click()
- Range("a3:p65536").ClearContents
- End Sub
复制代码 |
|