Sub Demo2()
Const D = ": "
Dim R&, V, W, Obj As Object, S$(), oSpan As Object
With Range("A1", Cells(Rows.Count, 1).End(xlUp)).Columns
R = .Rows.Count: If R = 1 Or Application.CountA(.Item(4)) = R Then Beep: Exit Sub
V = .Item(1).Value2
W = .Item(4).Value2
End With
Application.Cursor = xlWait
On Error GoTo Fin
With CreateObject("InternetExplorer.Application")
For R = 2 To R
If V(R, 1) > "" And W(R, 1) = "" Then
.Navigate "https://barcodelookup.com/" & V(R, 1)
While .Busy Or .readyState < 4: DoEvents: Wend
If IsObject(.document.all("h1-404")) Then
Cells(R, 4).Value2 = " not valid barcode !"
Else
Cells(R, 5).Value2 = .document.getElementsByTagName("H4")(0).innerText
For Each Obj In .document.getElementsByClassName("product-text-label")
S = Split(Obj.innerText, D)
Select Case S(0)
Case "Manufacturer"
Cells(R, 8).Value2 = S(1)
Case "Description"
Cells(R, 6).Value2 = S(1)
Case "Attributes"
For Each oSpan In Obj.getElementsByTagName("SPAN")
S = Split(oSpan.innerText, D)
Select Case S(0)
Case "Format"
Cells(R, 4).Value2 = S(1)
Case "MPN"
Cells(R, 10).Value2 = S(1)
Case "Release Date"
Cells(R, 12).Value2 = S(1)
Exit For
For Each Obj In .document.getElementsByClassName("Store-List")
S = Split(Obj.innerText, D)
Select Case S(0)
Case "Store-name"
Cells(R, 19).Value2 = S(1)
Exit For
End Select
Next
End Select
Next
End If
End If
Next
Fin:
If Err.Number <> -2147023706 Then .Quit
End With
If Err.Number Then Beep: Debug.Print "#" & Err.Number; " : "; Err.Description
Application.Cursor = xlDefault
Set oSpan = Nothing
End Sub