股票监控助手是一款利用excel制作的股票行情监控工具,软件体积小巧,是由吾爱论坛网友分享提供的,软件使用起来非常方便,非常适合不敢在工作时间大张旗鼓在网页查看行情的朋友,有需要的朋友快来下载试试吧。
软件说明
最近上班无聊,但是又不敢大张旗鼓打开浏览器去看股票,
于是在Excel里弄了个股票监控小助手,老板还以为我在认真分析数据
使用方法
在A列输入你的股票代码,然后点击按钮更新即可
系统:Win10 64OFFICE 365测试使用正常
源码分享
Sub GET_STOCK()
'-------------Clean old data--------------------------------
Dim bb%, aa%
aa = [d1048576].End(xlUp).row
bb = [b1048576].End(xlUp).row
Range("b3:r3" & bb).ClearContents
'--------------data update time-------------------------------
Range("B1") = Format(Now, "mm-dd / hh:mm:ss") 'update time
'---------------judge stock of SH or SZ------------------------------
For r = 3 To Range("A1").CurrentRegion.Rows.Count
dm = Cells(r, 1).Value
If left(dm, 1) = 6 Or dm = "000001" Then
url = "http://qt.gtimg.cn/q=sh" & dm 'Shanghai stock
Else
url = "http://qt.gtimg.cn/q=sz" & dm 'Shenzhen stock
End If
With CreateObject("msxml2.xmlhttp")
.Open "GET", url, False
.send
sp = Split(.responseText, "~")
If UBound(sp) > 3 Then
'---------------get data part------------------------------
Cells(r, 2).Value = sp(1) 'Name
Cells(r, 3).Value = sp(3) 'Current Price
Cells(r, 5).Value = sp(32) 'Up down %
Cells(r, 6).Value = sp(4) 'Yesterday Price
Cells(r, 7).Value = sp(5) 'Opening price
Cells(r, 8).Value = sp(33) 'Highest
Cells(r, 9).Value = sp(34) 'Minimum
Cells(r, 10).Value = sp(47) 'Harden price
Cells(r, 11).Value = sp(48) 'Drop stop price
Cells(r, 12).Value = sp(38) 'Turnover rate
Cells(r, 13).Value = sp(43) 'Amplitude
Cells(r, 14).Value = sp(6) 'Trading volume
Cells(r, 15).Value = sp(39) 'P/e ratio
Cells(r, 16).Value = sp(44) 'Current market
Cells(r, 17).Value = sp(45) 'Total market value
Cells(r, 18).Value = sp(46) 'price-to-book
'---------------Up or Down color------------------------------
Dim zhangDie As Double
zhangDie = sp(31) 'up down price
Cells(r, 4).Value = zhangDie 'up down price
If zhangDie > 0 Then
Cells(r, 4).Font.Color = vbRed
Cells(r, 5).Font.Color = vbRed
Else
Cells(r, 4).Font.Color = &H228B22
Cells(r, 5).Font.Color = &H228B22
End If
Else
End If
End With
Next
End Sub