Hello Excel supporters...
I am not sure if Worf or anyone in this forum can help me.
Below I have a file & code to scrape data from many links in investing.com
The trouble I am having is this:
On the web page. There is a "Time Frame" box list: Daily, Weekly & Monthly.
However, inspect the element. The box id for the "Time Frame" is id="data_interval", which holds the list for " Daily, Weekly & Monthly."
For some reason. I am not getting the code to give me data on the weekly and monthly bases. It only works for the daily bases.
How can I modify the code to work for all time frames and still maintain my end results in capturing only the latest "Date" and "Price"?...
On the excel worksheet. A dropdown list was created to change the time on the website...
If anyone is willing. Please view the file and code below to examine.
Thanks in advance
Cheers.
I am not sure if Worf or anyone in this forum can help me.
Below I have a file & code to scrape data from many links in investing.com
The trouble I am having is this:
On the web page. There is a "Time Frame" box list: Daily, Weekly & Monthly.
However, inspect the element. The box id for the "Time Frame" is id="data_interval", which holds the list for " Daily, Weekly & Monthly."
For some reason. I am not getting the code to give me data on the weekly and monthly bases. It only works for the daily bases.
How can I modify the code to work for all time frames and still maintain my end results in capturing only the latest "Date" and "Price"?...
On the excel worksheet. A dropdown list was created to change the time on the website...
If anyone is willing. Please view the file and code below to examine.
Thanks in advance
Cheers.
VBA Code:
Sub MMM()
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
x = Timer
On Error Resume Next
'Application.ScreenUpdating = False
With CreateObject("Selenium.ChromeDriver")
.AddArgument "--headless"
For i = 2 To LastRow
.Get Cells(i, 14)
.FindElementById("data_interval").AsSelect.SelectByText (Cells(1, 7).Value)
Cells(i, 10) = .FindElementById("curr_table").FindElementsByTag("tr")(2).FindElementsByTag("td")(1).Text
Cells(i, 9) = .FindElementById("curr_table").FindElementsByTag("tr")(2).FindElementsByTag("td")(2).Text
[N1].Value = Round((i - 2) / (LastRow - 2), 2)
' [k1].Value = "Progress : " & Round((i - 2) * 100 / (LastRow - 2), 0) & " %"
Next
.Quit
End With
y = Timer
' Application.ScreenUpdating = True
MsgBox "Time:" & Round(y - x, 0) & " secons"
End Sub
Web.xlsm
drive.google.com