hockeyfanm13
New Member
- Joined
- Feb 9, 2018
- Messages
- 6
Hey everyone. I used a youtube video to modify a sub to help me track sent packages. It works perfectly for the first tracking number. However, I'm a little confused as to how to make the sub loop correctly down the "A" column to show results in the "C" and "D" columns. In the actual file, I will be using columns "I" & "J". I was also thinking about putting a wait time of about 15 seconds between each loop as it takes a few seconds to pull the data from the site. Essentially I will be exporting the shipment information at the end of the day and copying it into the worksheet, which is why I have it set to "Worksheet Change".
(Tracking Numbers are non working)
<tbody>
</tbody>
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row =Range("a1").Row And _
Target.Column =Range("a1").Column Then
Dim IE As New InternetExplorer
'IE.Visible = True
IE.navigate"https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums="& Range("a1").Value
Do
DoEvents
Loop Until IE.readyState =READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = IE.document
Dim sDiv As String
sDiv = Trim(doc.getElementsByClassName("ups-groupups-group_condensed")(0).innerText)
Dim sriv As String
sriv =Trim(doc.getElementsByClassName("ups-groupups-group_condensed")(1).innerText)
Range("c1") = sDiv
Range("d1") = sriv
End If
End Sub
Any and all help is much appreciated!
(Tracking Numbers are non working)
6234982497249 | Delivered: 01/01/01 | Left at Front Porch | |
2498273498237 | |||
2389723948723 | |||
4230974239743 | |||
2349023409234 |
<tbody>
</tbody>
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row =Range("a1").Row And _
Target.Column =Range("a1").Column Then
Dim IE As New InternetExplorer
'IE.Visible = True
IE.navigate"https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums="& Range("a1").Value
Do
DoEvents
Loop Until IE.readyState =READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = IE.document
Dim sDiv As String
sDiv = Trim(doc.getElementsByClassName("ups-groupups-group_condensed")(0).innerText)
Dim sriv As String
sriv =Trim(doc.getElementsByClassName("ups-groupups-group_condensed")(1).innerText)
Range("c1") = sDiv
Range("d1") = sriv
End If
End Sub
Any and all help is much appreciated!