请问以下这段代码中红色标注部分有什么作用呢?
我把红色部分的代码删除后,按F8单步运行能得到正确结果,但是直接点运行时却只能得到重复的数据,很疑惑,高手帮忙解释一下吧!把实例也传上来了
Sub a()
Dim ie1 As Object, dmt As Object, r As Object, i As Long, j As Long, n As Long, p As Long
'Load UserForm1
'UserForm1.Show 0
On Error Resume Next
[a1].CurrentRegion.Offset(1).Clear
Cells.NumberFormat = "@"
Set ie1 = UserForm1.WebBrowser1
With ie1
.Navigate "http://stock. '网址
Do Until .ReadyState = 4 And InStr(.Document.body.innertext, "行情 资讯 股吧") > 0
DoEvents
Loop
Set dmt = .Document
End With
Set r = dmt.All.tags("table")(1).Rows
For i = 0 To r.Length - 1
For j = 0 To r(i).Cells.Length - 1
Cells(i + 2, j + 1) = r(i).Cells(j).innertext
Next
Next
Set dmt = Nothing
Set r = Nothing
For p = 2 To 23
With ie1
.Navigate "javascript:myNiceTable.goPage(" & p & ");"
Do Until Val(.Document.All.tags("table")(1).Rows(0).Cells(0).innertext) = (p - 1) * 50 + 1
DoEvents
Loop
Set dmt = .Document
End With
Set r = dmt.All.tags("table")(1).Rows
n = [a65536].End(3).Row + 1
For i = 0 To r.Length - 1
For j = 0 To r(i).Cells.Length - 1
Cells(i + n, j + 1) = r(i).Cells(j).innertext
Next
Next
Set dmt = Nothing
Set r = Nothing
Next
Set ie1 = Nothing
[a1].CurrentRegion.Columns.AutoFit
MsgBox "ok!"
End Sub