Need help - macro question

December 15, 2016 at 08:58:48
Specs: Windows 64
https://ufile.io/572b1

Hi guys. I came across this file online. I'm trying to do a similar project with this concept but I have no macro experience. Would anyone be able to share with me where did the macro pulls the information from yahoo finance? If I want it to pull from another site, how can I change it?


See More: Need help - macro question

Report •

#1
December 15, 2016 at 09:58:45
As I am not familiar with that site, I am not going to look at the file.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
December 15, 2016 at 16:23:22
Hi. Could you try this instead?

https://www.dropbox.com/s/4z7mg6o1i...

message edited by xfer


Report •

#3
December 15, 2016 at 18:48:58
Right click on any sheet tab and choose View Code.

Under the name of the workbook you'll see Module 1. All of the code is stored in that module.

I see a reference to a Yahoo site, but I don't know if it be changed to some other site just by entering a different url. I don't have time to dig into the code right now, but it's possible that the data that is retrieved from the Yahoo site is formatted in such a way that it's the only data that the rest of the code can deal with.

What is it that you are trying to do?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
December 15, 2016 at 19:15:02
The macro asks for the data from yahoo in a .CSV format. Your desired website would have to offer the data you want both publicly and in a similar format.

How To Ask Questions The Smart Way


Report •

#5
December 16, 2016 at 08:01:35
I'm trying to ride on the result pulled from this spreadsheet.

I saw the following two sets of codes:

        qurl = "http://ichart.finance.yahoo.com/table.csv?s=" & Symbol
        qurl = qurl & "&a=" & Month(StartDate) - 1 & "&b=" & Day(StartDate) & _
            "&c=" & Year(StartDate) & "&d=" & Month(EndDate) - 1 & "&e=" & _
            Day(EndDate) & "&f=" & Year(EndDate) & "&g=m" & Sheets("Data").Range("a1") & "&q=q&y=0&z=" & _
            Symbol & "&x=.csv"
                   
        qurlw = "http://ichart.finance.yahoo.com/table.csv?s=" & Symbol
        qurlw = qurlw & "&a=" & Month(FifteenYear) - 1 & "&b=" & Day(FifteenYear) & _
            "&c=" & Year(FifteenYear) & "&d=" & Month(LastYear) - 1 & "&e=" & _
            Day(LastYear) & "&f=" & Year(LastYear) & "&g=w" & Sheets("Data2").Range("a1") & "&q=q&y=0&z=" & _
            Symbol & "&x=.csv"

I'm guessing both sets of data tells the macro to pull the specified day, month and year from a field in the first tab of the excel sheet.

Am I right to suggest that if this macro doesnt work one day, the only reason is an updated link:

http://ichart.finance.yahoo.com/table.csv?s=

As long as I can continue retrieving information from this excel, I'm good for now.


Edit:
I did a test on the yahoo site. By manually inputting my requirement, this is the result:

https://finance.yahoo.com/quote/DIS/history?period1=978192000&period2=1451491200&interval=1wk&filter=history&frequency=1wk

If you right click on the "Download Data" and copy the link, this is what it shows:

http://chart.finance.yahoo.com/table.csv?s=DIS&a=11&b=31&c=2000&d=11&e=31&f=2015&g=w&ignore=.csv

Thats the .csv file mentioned in the prior post. The macro link currently points to "ichart" while my manual search brings me to "chart" instead. I tried downloading from "ichart" and it seems to yield the same result. Should I be concern about this or is it common to have various links to a single set of data?

message edited by xfer


Report •

#6
December 16, 2016 at 11:47:05
What, URL redirection? It's not that uncommon, but that's only if both links point to the same system behind the scenes. It could be a similar system producing similar output by pulling from the same sources. Yahoo's a big company, and apparently pretty mismanaged, if you go by all of the security reports and alerts that are coming to light.

How To Ask Questions The Smart Way


Report •

Ask Question