VBA循环停止整个function

我有一个小问题,我从各种来源(包括这里拼凑在一起的一些VBA)基本上我试图循环通过一个客户帐户列表input到单元格列表,并使用InStr告诉我是否没有关键字出现在他们的帐户历史logging。 到目前为止,它对一个帐号很有用,但是当我尝试创build一个循环来浏览帐户列表时,函数似乎只是在循环的开始处停止。 这里是VBA …

Dim rowData As Long Dim lastRow As Integer lastRow = Cells(10000, 7).End(xlUp).Row rowData = 7 For x = rowData To lastRow With IE .Visible = True .navigate my_url2 End With Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop IE.Document.all("acct").Value = Me.Cells(x, 3).Value IE.Document.all("Lookup").Click Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop IE.Document.getElementsByTagName("iframe")(0).contentWindow.Document.getElementsByTagName("input")(1).Click 'clicks button to open history Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop With IE .Visible = True .navigate my_url4 End With Do Until Not IE.Busy And IE.readyState = 4 DoEvents Loop promo = IE.Document.all If InStr(promo.innerText, Range("E5").Value) = 0 Then ActiveSheet.Range("C10") = "No" Else ActiveSheet.Range("C10") = "Yes" End If Next x 

对于循环函数,我绝对不是最好的,但我希望也许这里有一些简单的东西。 任何帮助将非常感激。 谢谢!