+ Reply to Thread
Results 1 to 5 of 5

Need help with code that will build a URL

  1. #1
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Need help with code that will build a URL

    The goal is to be able to key in a date and have Excel import historical stock data. Right now, help is needed in setting up the variables in VBA (DIM, Set, etc) and building the URL.

    The stock: NKE
    Start date is March 19 2007
    End date: May 19 2007

    The resulting URL is:

    http: //finance.yahoo.com/q/hp?s=NKE&a=02&b=19&c=2007&d=04&e=19&f=2007&g=m

    Components of the URL

    NKE = stock ticker

    Start date
    02 = March (The months start with Jan = 00 thru Dec = 11)
    19 = day
    2007 = Year

    End Date
    04 = May
    19 = day
    2007 = year

    m = provide data by month (d = daily and w = weekly but I and going to stick with retrieving monthly data)

    How do I start this code in order to put 3/19/2007 into a single cell and have VBA build the URL with an end date automatically 2 months later?
    Last edited by Habanero Time; 02-17-2012 at 10:10 PM.

  2. #2
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Need help with code that will build a URL

    I'm thinking of having the Start Date input in 3 different columns to help control how users load the info. Maybe this will help avoid having to write code that can handle all of these variations of the same date:

    9JAN06
    1/09/06
    1/09/2006
    1.9.06
    9.1.2006

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Need help with code that will build a URL

    How much can I charge you to do something like this?

  4. #4
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Need help with code that will build a URL

    Quote Originally Posted by JieJenn View Post
    How much can I charge you to do something like this?
    OUCH! I'll have to think about that.

  5. #5
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Lightbulb Re: Need help with code that will build a URL

    My code is a bit raggedy but I pieced together something that does build the correct URL



    Please Login or Register  to view this content.

+ 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