我有一些小问题我从各种来源拼凑了一些VBA(包括这里!)基本上我试图遍历输入到列表中的客户帐户列表单元格并使用InStr告诉我关键字是否显示在其帐户历史记录中。到目前为止,它适用于一个帐号,但是当我尝试创建一个循环来查看帐户列表时,该函数似乎只是在循环开始时停止。这是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
在谈到循环功能时,我绝对不是最好的,但我希望也许这里有一些简单的东西,我在这里不见了。任何帮助都非常感谢。谢谢!