|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Range("a4:d65536").ClearContents
Dim i, j, arr
Dim s() As String
PD = Range("A2")
With CreateObject("MSXML2.XMLHTTP")
If PD = "3D" Then
.Open "GET", "http://www.17500.cn/getData/3d.TXT", False
Else
.Open "GET", "http://www.17500.cn/getData/p3.TXT", False
End If
.Send
s = Split(.responseText, Chr(10))
End With
List = Array(0, 2, 3, 4, 5, 6, 7)
ReDim arr(1 To UBound(s), 1 To 8)
Range("D1") = UBound(s)
For i = UBound(s) - Range("C1") To UBound(s) - 1
For j = 1 To 7
arr(i - UBound(s) + Range("C1") + 1, j) = Split(s(i), " ")(List(j - 1))
Next j
Next i
With Cells(4, 1).Resize(UBound(s), 4)
' .ClearContents
.Value = arr
End With
zh = Range("A65536").End(xlUp).Row '数据最后行号
'MsgBox ("!!乐助制表==数据更新完成 !!")
Application.ScreenUpdating = True
ActiveWindow.ScrollRow = zh - ActiveWindow.VisibleRange.Rows.Count + 3
Range("A3").Select
End Sub
|
|