Scrap data from Yahoo Finance

Chandresh

Board Regular
Joined
Jul 21, 2009
Messages
146
Hi Team,

i am trying to scrap finance data (Stock Price)using excel VBA, i have written below code but unable to scrap the data.

!!! need urgent help !!!


Sub macro1()
Dim ie As Object
Set rgn = Range("A3:A5")


Set Row = Range(rgn.Offset(1, 0), rgn.Offset(1, 0).End(xlDown))


Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
For Each Row In rgn
.navigate "finance.yahoo.com/quote/IBM?p=IBM"


Do
DoEvents
Loop Until ie.readystate = READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = ie.document
While ie.readystate <> 4
Wend

Range("B" & Row.Row) = doc.getclassbyid("data-reactid=35").Value
.innertext

Next Row


End With
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,224,828
Messages
6,181,212
Members
453,023
Latest member
alabaz

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