Results 1 to 4 of 4

Getting sparklines to refresh along with data import of stock prices from web

Threaded View

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    38

    Getting sparklines to refresh along with data import of stock prices from web

    I'm relatively new to VBA, but have been increasing my exposure over time. Along time ago while first learning about web queries I stumbled upon this code I believe I got from Chip Pearson (per the note left behind). He has a site with a lot of downloads and help available if you care to Google him. Anyway found this code that wasn't useful to me at the time, but saved it and now suddenly I have use for it. Essentially you can have a list of stock symbols/tickers, input a date range, hit the control button and it will retrieve historical stock prices from yahoo finance and place each set of historical price data into a new tab/worksheet and re-title the worksheet with the ticker symbol. I modified the sheet a bit such that I pull data from the tabs and perform other processes with the data download.

    What I am stuck with:
    I'd like to add sparkline cells corresponding to the row/ticker that will refresh each time I download new data. See my attachment and hit the retrieve button, you will notice that the sparklines disappear. I believe this is happening because the VBA code deletes the sheets then creates a new one and labels it with the ticker symbol, however the sheet data that the sparklines were referring to is no longer there (despite being named the same as the previous location). I noticed this when I have the editor project pane open and it displays the 'name' in parentheses , but the sheet numbers change with each successive button click. I'm not clever enough yet to pick apart the wonderful code I lifted; Is there a way that when you refresh the data download it just overwrites the same sheet, so that the spark line references reflect the 'new' data? Is there another way to write the code to get to my end goal?

    Additional challenge! (read on)

    The list of tickers I want to retrieve may change dramatically not only in quantity but also the names, the date range I would be interested may also change significantly. That said I'd like to some how figure out a way/formula to input such that the sparkline array reference will change according to the ticker/tab name and the column array dimension. Ideally I'd like to copy the first row/set of formulas (under the brown column headings) drag and paste all the way down to the last ticker. I've played a bit with the range selection portal that pops up when creating the sparkline and some formulas (i.e INDIRECT) just don't work there.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Import stock prices into Excel 2010
    By SteverizerAZ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2015, 05:09 PM
  2. Import Historical Stock Prices from Yahoo
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2011, 12:15 AM
  3. Stock Prices import
    By roger00782006 in forum Excel General
    Replies: 9
    Last Post: 12-09-2010, 11:23 AM
  4. Get closing stock prices from outside data source
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2008, 02:36 PM
  5. stock prices; EOD data from internet
    By impala096 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-11-2008, 09:28 AM

Tags for this Thread

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