+ Reply to Thread
Results 1 to 9 of 9

Scraping Data from a URLs List Into Excel Using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    03-18-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    14

    Scraping Data from a URLs List Into Excel Using VBA

    I have a list of several hundred URLs in Excel. The URLs are all from the same site and have the same format and structure, but the specific data on the page varies (example about one URL: http://finance.vietstock.vn/DPM/1/co-dong-lon.htm. I am hopeful that there is a way to do this using VB, but I have not been able to get it to work.

    I have successfully used a Web Query for one of the URLs from my list (the link above) into Sheet 2. My workbook have two sheet: Sheet 2 with the result from the above URL and Sheet 1 has the URLs list. Now I need an automated solution that will look up the next URLs in the list, run the Web Query and download new data to new sheets (one sheet for one URL).

    Does anyone have any pointers how to do this? Or perhaps a better way to accomplish this than using VB? Thanks for your help!

    P/S: This is my file, for your reference.

    https://drive.google.com/file/d/0B3g...ew?usp=sharing
    Attached Files Attached Files
    Last edited by mayaincaztec; 03-18-2015 at 10:56 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scraping Data from a URLs List Into Excel Using VBA

    I do not see the list of URLs in sheet1.

  3. #3
    Registered User
    Join Date
    03-18-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    14

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Quote Originally Posted by AB33 View Post
    I do not see the list of URLs in sheet1.
    Oh sorry, I attached wrong file.
    I've fixed the post. I just have 4 URLs for an example. My full list has more than 400 URLs

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Where do you get the names of new sheets? I used columns B values, but some of the rows are duplicates, so I can not use the same name. Each name has to be unique. Obviously, the code will be very slow
    Try
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-18-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    14

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Quote Originally Posted by AB33 View Post
    Where do you get the names of new sheets? I used columns B values, but some of the rows are duplicates, so I can not use the same name. Each name has to be unique. Obviously, the code will be very slow
    Try
    Hi AB33,

    Thank you so much for your reply. I've tried the code and it succeeded. But if I want to combine sheet with the same ticker, for example: ABT1 and ABT2 into 1 sheet (ABT), DPM1 and DPM2 into 1 sheet (DPM). Does that change all the VB code required, or should the initial code you gave me work with a little fitting? Thanks again for your help
    Last edited by mayaincaztec; 03-18-2015 at 11:48 PM.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Try the attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-18-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    14

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Great! It works! Thank you very much for your help

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scraping Data from a URLs List Into Excel Using VBA

    You are welcome!

    Could you please now close (Mark) this thread as solved? Go to the top right-hand side of this page, choose "Thread Tools" from the menu, then select "solved" from the drop down menu.

  9. #9
    Registered User
    Join Date
    03-18-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    14

    Re: Scraping Data from a URLs List Into Excel Using VBA

    Quote Originally Posted by AB33 View Post
    You are welcome!

    Could you please now close (Mark) this thread as solved? Go to the top right-hand side of this page, choose "Thread Tools" from the menu, then select "solved" from the drop down menu.
    Sorry, I don't know about this rule. I'm newbie .
    Done it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 07-28-2014, 05:37 PM
  2. Get data from multiple web sites using list of URLs
    By andparry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2013, 02:06 PM
  3. EXCEL VBA: web query from a list of URLs within cells
    By IDONTTELLYOU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2012, 01:10 AM
  4. [SOLVED] Pulling source data from a list of URLs
    By Bootkie2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-26-2012, 11:23 PM
  5. Making hyperlinks to a whole list of urls in excel
    By max11 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-03-2007, 12:24 PM

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