Get table from web with selected item

svorm

New Member
Joined
Jan 30, 2019
Messages
5
Hi

i try to get data with the below code. it changes the dropdown menu and get data with this select.
But it works very slow. how can i make it faster.

VBA Code:
Sub web()
Dim objIE As Object
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate "https://www.isyatirim.com.tr/tr-tr/analiz/hisse/sayfalar/sirket-karti.aspx?hisse=AGHOL"
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
'1.KISIM
Set HTMLDoc = objIE.document
Set evtChange = HTMLDoc.createEvent("HTMLEvents")
evtChange.initEvent "change", True, False
Set selectElement = HTMLDoc.getElementById("ddlMaliTabloDonem1")
selectElement.Value = "2018/9"
selectElement.dispatchEvent evtChange
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
For I = 3 To 20
Range("b2") = "2018/9"
Application.Wait Now + TimeValue("00:00:02")
Cells(I, 2) = objIE.document.getElementById("tbodyMTablo").getElementsByTagName("tr")(I - 2).getElementsByTagName("td")(1).textContent
Application.Wait Now + TimeValue("00:00:02")
Cells(I, 1) = objIE.document.getElementById("tbodyMTablo").getElementsByTagName("tr")(I - 2).getElementsByTagName("td")(0).textContent
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
Next
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top