各网页格式混乱,试试: Sub MACRO1() Dim s() As String, t() As String, i As Long, j As Long, k As Long, temp As String On Error Resume Next With CreateObject("Msxml2.XMLHTTP") .Open "GET", "http://61.129.65.116/lottery/lotteryhtm/bulletin/14/select.htm", False .Send s = Split(.responseText, "option value='") ReDim ball(1 To UBound(s), 1 To 2) For i = 1 To UBound(s) Cells(i, 1) = "No. " & Split(Split(s(i), "'>")(1), "<")(0) .Open "GET", "http://61.129.65.116/lottery/lotteryhtm/bulletin/14/bot" & Split(s(i), "'>")(0) & ".htm ", False .Send t = Split(.responseText, "</font>") temp = Right(t(UBound(t) - 1), 20) k = 0 For j = 1 To 20 If Not Mid(temp, j, 1) Like "#" Then Mid(temp, j, 1) = " " Next Cells(i, 2) = Trim(Replace(temp, " ", " ")) If i = 100 Then Exit Sub Next End With End Sub |