1
I want to collect two values of an HTML through VBA. The information '40 New' and '$19.95'. My code can get '$19.95', but in the next iteration it overwrites and gets '$17.38'.
`Set QuestionList = html.getElementById("olp_feature_div")
Set Questions = QuestionList.Children
For Each Question In Questions
If Question.className = "a-section a-spacing-small a-spacing-top-small" Then
Set QuestionFields = Question.all
For Each QuestionField In QuestionFields
If QuestionField.className = "a-color-price" Then
votes = Replace(QuestionField.innerText, "votes", "")
votes = Replace(votes, "vote", "")
Cells(RowNumber, 2).Value = Trim(votes)
End If
Do not understand, you want to stop the repetition in the first element found?
– Lucio Rubens
Yes, in this case, but the criterion cannot be the position, because sometimes '40 New' is the second element. If there is a way to get the element inside the class that contains the string 'new', the problem is solved. I don’t know how to do it.
– João Pontes
Could you put in the full code you have? And also what website you’re using, because from what I could find, it’s an Amazon page, I even managed to get the
40 new
, but I did not find the classa-color-price
within the divolp_feature_div
– mateusalxd