我需要一些帮助,而不是精神上的哈哈,这是一个不同的问题,这个问题我投入了数十个小时,实际上无法找到哪种类型的循环或下一步将帮助我循环我的代码,我做了很多研究一直进行下去,直到循环不断地循环遍历第一个汽车登记号或下一个循环,这将使汽车登记栏无效,但实际上不会使用下一个汽车登记表。我要我的工作表做的是对汽车进行注册并检查其税金和有效期,然后对那个mot和税金日期或缺乏日期进行保存,然后将其放在汽车注册旁边的栏中,完成后即可与下一个汽车规则相同(当前位于x列中)。同样,如果有错误或没有日期,则只需在汽车规则旁边的单元格中未放置任何日期,然后仍然移至下一个汽车规则行以进行相同的检查,直到x列中的单元格为空白/空。我在这里得到了一些人的帮助,并且已经为其他部分获得了一些工作代码,我想尽可能地保留此代码,我对所有这些都是新手,因此在我自己时要保持自身的一致性学习,已经进行了3周,所以时间不长,任何新事物都会使我步履蹒跚,并使我的事情变得复杂。
第一个汽车登记证将在x列第3列,之后的下一个汽车登记册在x列第4列,依此类推。我在与之相关的汽车法规旁边的栏中输入相对汽车法规的日期。
我是一名欺诈调查员,认为前进的道路是由欺诈专家驱动的软件,这是针对excel vba(因为大多数公司都将excel用于管理信息报告和数据分析),这是我为自己所做的一个项目,帮助我工作上的进步并防止欺诈,因此您在这里的帮助将对我有帮助。到目前为止,我已经很感谢您对本网站的帮助,非常感谢到目前为止对我有帮助的人。
Sub TAXandMOTcheck()
'dimension (declare or set aside memory for) our variables
Dim objIE As InternetExplorer 'special object variable representing the IE browser
'''''''''''''''''''''''''''''''''''''''''''
Dim valueofInterest As Integer
Range("x3").Select
Do Until ActiveCell.Empty
End If
ActiveCell.Offset(1, 0).Select
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''
' START OF THE CODE THAT WORKS, PLEASE DONT CHANGE IT IF POSSIBLE '''''''''''''''''''''''''''''''''''''''''''
'OPEN INTERNET
'initiating a new instance of Internet Explorer and asigning it to objIE
Set objIE = New InternetExplorer
'wait # seconds
Application.Wait Now + TimeValue("00:00:05")
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''
'OPEN TAX/ MOT PAGE
'navigate IE to this web page (a pretty neat search engine really)
objIE.Navigate "https://vehicleenquiry.service.gov.uk/"
'make IE browser visible (False would allow IE to run in the background)
objIE.Visible = True
'wait # seconds
Application.Wait Now + TimeValue("00:00:05")
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''
'ENTER DETAILS IN TO PAGE
'in the search box put cell "x3" value
objIE.Document.getElementById("Vrm").Value = _
Sheets("INPUT DATA").Range("x3").Value
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'wait # seconds
Application.Wait Now + TimeValue("00:00:03")
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'click the 'Continue' button
objIE.Document.getElementsByClassName("button")(0).Click
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'wait # seconds
Application.Wait Now + TimeValue("00:00:03")
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'click the 'Yes' button
objIE.Document.getElementById("Correct_True").Click
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'click the 'Continue' button
objIE.Document.getElementsByClassName("button")(0).Click
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'wait # seconds
Application.Wait Now + TimeValue("00:00:03")
'wait here a few seconds while the browser is busy
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'TAX EXPIRY DATE:
'get data inside element
TaxExpiryDate = objIE.Document.getElementsByClassName("status-bar")(0).getElementsByTagName("strong")(0).innerText
'split the date from the words
TaxExpiryDate = Split(TaxExpiryDate, vbNewLine)(1)
'add tax date to sheet
Range("y3").Value = TaxExpiryDate
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'MOT EXPIRY DATE:
'get data inside element
MotExpiryDate = objIE.Document.getElementsByClassName("status-bar")(0).getElementsByTagName("strong")(1).innerText
'split the date from the words
MotExpiryDate = Split(MotExpiryDate, vbNewLine)(1)
'add mot date to sheet
Range("z3").Value = MotExpiryDate
'''''''''''''''''''''''''''''''''''''''''''
'close the browser
objIE.Quit
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''
' END OF THE ABOVE CODE THAT WORKS, PLEASE DONT CHANGE THIS IF POSSIBLE '''''''''''''''''''''''''''''''''''''''''''
Loop
'''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''
' THE BELOW CODE WORKS PLEASE DONT CHANGE IT IF POSSIBLE '''''''''''''''''''''''''''''''''''''''''''
'message boxes if true or false
If found = True Then
MsgBox "Value found in cell" & ActiveCell.Address
Else
MsgBox "Be Happy and Smile, its the end of the search. Just keep swimming, just keep swimming..."
End If
'''''''''''''''''''''''''''''''''''''''''''
'exit our SearchBot subroutine and start new row for new website data
End Sub