# get data with product variations using vba

#### amo

##### Board Regular
In one product, there are several choices of product variations such as color and size

this is the site https://shopee.co.id/sepatu-gunung-...utdoor-touring-beckham-i.234869233.4319432435

can someone help improve my code

I want to get data :
price variations
stock variations
size and color variations

VBA Code:
``````Sub trial()

Dim Ie As InternetExplorer
Dim html As HTMLDocument
Dim URLNAME As String
Dim sht As Worksheet
Dim stock As String
Dim tag As Object
Dim price  As String

Dim EndRow As Long, i As Long   'ADDED

Set sht = ActiveSheet
EndRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row

For i = 3 To EndRow
URLNAME = Cells(i, 1).Value
On Error Resume Next
Set Ie = New InternetExplorer
Ie.Visible = true  'to allow you to see what is going on
'Application.Wait (Now + TimeValue("00:00:05"))
Ie.navigate URLNAME
On Error Resume Next
Do
DoEvents
Application.Wait (Now + TimeValue("00:00:05"))
Set html = Ie.document

On Error Resume Next

price = html.getElementsByClassName("AJyN7v")(0).innerText
For Each tag In html.getElementsByClassName("flex items-center _2_ItKR")
stock = tag.getElementsByTagName("Div")(1).innerText
Next

Sheet3.Cells(i, 4) = price
Sheet3.Cells(i, 5) = stock

Ie.Quit
Set Ie = Nothing
Application.StatusBar = ""
On Error GoTo 0

Next i
End Sub``````

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Replies
2
Views
156
Replies
0
Views
81
Replies
6
Views
169
Replies
1
Views
147
Replies
6
Views
118

1,136,777
Messages
5,677,673
Members
419,711
Latest member
dacrmcvega0

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back