因为以上网页打不开,现发一个其它网站的代码。
- Sub 沪深A股2()
- With CreateObject("Microsoft.XMLHTTP")
- .Open "GET", "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=3000&page=1&jsName=quote_123&style=33&_g=" '& Rnd(), False
- .Send
- v = .responseText
- End With
-
- strText = Split(Split(v, "[""")(1), """]")(0)
-
- Cells.ClearContents
- Dim arr() As String
- arr = Split(strText, """,""")
- Range("b2:b" & (UBound(arr) + 2)) = Application.Transpose(arr)
- FenLie
- ' Columns("B:B").TextToColumns Destination:=Range("B1"), DataType:=1, Comma:=True, FieldInfo:=Array(Array(1, 9), Array(2, 1)), TrailingMinusNumbers:=True
- [a2] = 1: [a3] = 2: [a2:a3].AutoFill Range("a2:a" & UBound(arr) + 1)
- [a1:t1] = Split("序号 代码 名称 最新价 涨跌额 涨跌幅 买入 卖出 昨收 今开 最高 最低 成交量/手 成交额/万 更新时间 市盈率 市净率 总市值 流通市值 换手率")
- Range("W1").Select
- End Sub
- Sub FenLie() 'fenlie
- Columns("B:B").TextToColumns Destination:=Range("B1"), DataType:=1, Comma:=True, FieldInfo _
- :=Array(Array(1, 9), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
- Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1 _
- ), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array _
- (20, 9), Array(21, 9), Array(22, 9), Array(23, 1), Array(24, 1), Array(25, 1), Array(26, 9), _
- Array(27, 1), Array(28, 9), Array(29, 1), Array(30, 9), Array(31, 1), Array(32, 1), Array(33, 1))
- End Sub
复制代码 |