|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 蓝天630902 于 2012-1-18 10:15 编辑
Sub test()
Dim tmp() As String, i As Integer, arr(), xmlhttp As Object, n As Long, JC As Worksheet, Td As String, ws As Worksheet, sName As String, d, DS, j As Long, Nm As Long, k, t, Y, ARR2(), tmp1()
Application.ScreenUpdating = False
On Error Resume Next
[a1:m1] = Split("代码,2B,3c,名称,最新价,涨跌幅,今日主力净流入,,今日超大单净流入,,今日大单净流入,,今日中单净流入,,今日小单净流入", ",") '当日表表头
[g2:p2] = Split("净额,净占比,净额,净占比,净额,净占比,净额,净占比,净额,净占比", ",")
For k = 1 To 49
With CreateObject("Msxml2.XMLHTTP")
.Open "get", "http://data.eastmoney.com/zjlx/data.aspx?type=detail&cate=0&day=1&sortType=6&sortRule=-1&jsname=NYLByphS&page=" & k, False
.send
ste = .responseText
tmp = Split(Split(Split(Replace(ste, """,""", ","), "[""")(1), """]")(0), ",")
End With
ReDim arr(UBound(tmp) \ 17, 17) '整理XMLHTTP获取的数据
For i = 0 To UBound(tmp)
arr(i \ 17, i Mod 17) = tmp(i)
Next
t = (k - 1) * 50 + 3
Range("a" & t & ":p" & t + 50) = arr
'[a3].Resize(UBound(arr, 1) + 1, UBound(arr, 2) + 1) = arr '将数据导入当日表内并设置格式调整列宽
Next k
[a:m].Columns.AutoFit
Columns("b:c").ColumnWidth = 0
Columns("a").NumberFormat = "000000"
Columns("h").NumberFormat = "-0.00"
Columns("f").NumberFormat = "0\.00%"
Columns("j").NumberFormat = "0\.00%"
End Sub
|
|