返回

Excel专题问题求助

◆ 微信扫描二维码分享
◆ 手机QQ扫描二维码,点击右上角···分享到QQ好友或QQ空间
请拨打电话:4008017500

更多 关闭

求助高手修改或调试代码 谢谢

神舟六号

2022-12-14 16:12:08

Sub 快乐8更新()
Application.ScreenUpdating = False
    Dim i&, j&, arr(), xx, k
    Dim s() As String
    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", "http://data.17500.cn/kl8_asc.txt", False
        .Send
        s = Split(.responseText, Chr(10))  需要调试
    End With
    xx = Application.InputBox(Prompt:="请输入数字: 目前有" & UBound(s) & "期", Title:="要保留多少期", Type:=1, Default:=UBound(s))
    If TypeName(xx) = "Boolean" Then
        MsgBox "你已取消了输入!"
        Exit Sub
    End If
    If xx > UBound(s) Then: Exit Sub
   
    List = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)
    ReDim arr(1 To UBound(s), 1 To 22)
    t = 0
    For i = UBound(s) - xx To UBound(s) - 1
        t = t + 1
        For j = 1 To 22
            arr(t, j) = Split(s(i), " ")(List(j - 1))
        Next j
    Next i
    Sheets("data").Cells(2, 1).Resize(10000, 22).ClearContents
    Sheets("data").Cells(2, 1).Resize(UBound(s), 22).Value = arr
    Sheets("data").Cells(1, 6) = "总" & UBound(s) & "期 "
    'MsgBox "更新完毕"
    Application.ScreenUpdating = True
    Sheets("期数表").Cells(2, 1) = 1
    Sheets("期数表").Select
End Sub

上一篇 下一篇

615

5