|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
分享一个股票实时数据系统
Sub 实时数据()
On Error Resume Next
Dim i As Long, j As Long, dm As String, url As String, xx() As String, yy() As String
Sheets("实时数据").Select
n = n + 1
For i = 3 To [A65536].End(3).Row
dm = Cells(i, 1).Value
If Val(dm) < 600000 Then
url = "http://qt.gtimg.cn/q=sz" & dm
Else
url = "http://qt.gtimg.cn/q=sh" & dm
End If
If Val(dm) = 1 Then url = "http://qt.gtimg.cn/q=sh000001"
With CreateObject("msxml2.xmlhttp")
.Open "get", url, False
.send
xx = Split(.responsetext, "~")
If UBound(xx) > 1 Then
Cells(i, 2) = xx(1)
Cells(i, 3) = xx(3)
Cells(i, 4) = xx(31)
Cells(i, 5) = xx(32)
Cells(i, 6).Value = Format(xx(30), "0000-00-00 00:00:00")
Cells(i, 7) = xx(4)
Cells(i, 8) = xx(5)
Cells(i, 9) = xx(33)
Cells(i, 10) = xx(34)
Cells(i, 11) = xx(43)
Cells(i, 12) = xx(38)
Cells(i, 16) = xx(39)
Cells(i, 17) = xx(6)
Cells(i, 18) = xx(37)
Cells(i, 19) = xx(47)
Cells(i, 20) = xx(48)
Cells(i, 21) = xx(44)
Cells(i, 22) = xx(45)
End If
End With
Next i
For j = 3 To [A65536].End(3).Row
dm = Cells(j, 1).Value
If Val(dm) < 600000 Then
url = "http://qt.gtimg.cn/q=ff_sz" & dm
Else
url = "http://qt.gtimg.cn/q=ff_sh" & dm
End If
If Val(dm) = 1 Then url = "http://qt.gtimg.cn/q=ff_sh000001"
With CreateObject("msxml2.xmlhttp")
.Open "get", url, False
.send
yy = Split(.responsetext, "~")
If UBound(sp) > 1 Then
Cells(j, 13) = yy(1)
Cells(j, 14) = yy(2)
Cells(j, 15) = yy(3)
End If
End With
Next j
[C1] = n
End Sub
股票实时数据.rar
(23.45 KB, 下载次数: 1180)
|
评分
-
6
查看全部评分
-
|