+ Reply to Thread
Results 1 to 10 of 10

Macro to download monthly stock data and to refresh that data with the macro

Hybrid View

  1. #1
    Registered User
    Join Date
    10-04-2010
    Location
    Tajiskitnxmas
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to download monthly stock data and to refresh that data with the macro

    Thank you so much marvin!

  2. #2
    Registered User
    Join Date
    05-23-2011
    Location
    new zealand
    MS-Off Ver
    Excel 2007
    Posts
    5

    Smile Re: Macro to download monthly stock data and to refresh that data with the macro

    Hi marvin, may be u can help me here... I had a similar query and everything works the way u explain above, however i am trying to retrieve Income statement, balance sheet and cash flow data. Now my problem is : The data that it retrieves is Quarterly data and not annual data, although i have written a macro for Annual data . Below is the code :
    How do i solve this problem...plz help

    At the same time if i replace the stockSymbol variable with a ticker like WMT (Walmart) then it works fine...

    Public Sub GetHistoricalStockPrices1(ByVal StockSymbol As String)
    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;http://finance.yahoo.com/q/is?s=" & StockSymbol & "+Income+Statement&annual", Destination _
    :=Range("$c$3"))
    .Name = "is?s=A+Income+Statement&annual"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingNone
    .WebTables = "10"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With
    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;http://finance.yahoo.com/q/bs?s=" & StockSymbol & "+Balance+Sheet&annual", Destination:= _
    Range("$I$3"))
    .Name = "bs?s=B+Balance+Sheet&annual"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingNone
    .WebTables = "10"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With

    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;http://finance.yahoo.com/q/cf?s=" & StockSymbol & "+Cash+Flow&annual", Destination:= _
    Range("$O$3"))
    .Name = "cf?s=C+Cash+Flow&annual"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingNone
    .WebTables = "10"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With

    End Sub
    Sub RunFromButtonPress1()
    GetHistoricalStockPrices1 (ActiveSheet.Range("a1"))
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1