+ Reply to Thread
Results 1 to 17 of 17

Web Scraping Data Using VBA

  1. #1
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Web Scraping Data Using VBA

    Hello,

    I have list of Industries and the respective companies in the following link

    http://www.moneycontrol.com/stocks/m...code=Abrasives

    The Hyperlink of Each Company opens the below webpage

    http://www.moneycontrol.com/india/st...umuniversal/CU

    From the above webpage I need to copy the following into excel sheet

    "BSE: 513375 | NSE: CARBORUNIV | ISIN: INE120A01034 | SECTOR: ABRASIVES"

    I am completely new to webscraping. Could some one help me , how to automate the task using VBA, so that I could get the required data of all the companies?

    Thank you

  2. #2
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Can anyone help me who is well versed in web scraping.

  3. #3
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Web Scraping Data Using VBA

    Please Login or Register  to view this content.
    Attached Files Attached Files
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  4. #4
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Sir,

    Thank you for the reply. But, the actual required data is different. I am attaching the same. Could you please look thorough the same?

    Regards,
    Zaska
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Can anyone well versed with web scarping , kindly suggest the solution?

    Thank you

  6. #6
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Web Scraping Data Using VBA

    Try this sample
    Attached Files Attached Files
    Last edited by kalbasiatka; 03-19-2016 at 10:34 AM.

  7. #7
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Sir,

    Thank you very much for helping me. I am asking out of curiousity , could you please kindly explain how did you identify class name ( tg.classname = "tbldata14 bdrtpg").

    Could you suggest me few books , which will help in learning about web scraping using excel VBA?

    Regards,
    Zaska

  8. #8
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Sir,

    I am getting Run time Error '9' Subscript out of range error at row No.272

    Please Login or Register  to view this content.
    I figured out that that this error occured when there are no companies for a particular Industry.

    http://www.moneycontrol.com/stocks/m...are%20Training
    Last edited by zaska; 03-19-2016 at 07:21 PM.

  9. #9
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Web Scraping Data Using VBA

    Hi,
    hopefully this is what you are after.
    This will run through your original page, pass the href links to some more code that will then find the data you want
    Attached Files Attached Files
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  10. #10
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Hello,

    Thank you for the code. The code is fetching data only for one industry "Abrasives". How to get the data for all the industries?

  11. #11
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Web Scraping Data Using VBA

    Yes, the error was due to an empty table. Amended code.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Thank you. Could you please suggest few good books / sources which help in learning about web scraping using excel. I am curious to learn.

  13. #13
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Web Scraping Data Using VBA

    I have not read the books, so I can not advise.

  14. #14
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Then how did you acquire this skill?

  15. #15
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Web Scraping Data Using VBA

    There are many excel forums, where you can learn. To help solve other people's problems.

  16. #16
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Ok. Thank you Sir.

  17. #17
    Forum Contributor
    Join Date
    06-20-2012
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    454

    Re: Web Scraping Data Using VBA

    Hello,

    I am getting "Run-time error '-2147012890 (80072ee6)':
    Method 'open' of object 'IServerXMLHTTPRequest2' failed"

    at line
    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)

Similar Threads

  1. Data Scraping from the WebSite
    By sathis in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-26-2015, 10:46 AM
  2. Having trouble scraping data from IE
    By fabolous15 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-22-2015, 01:56 AM
  3. Scraping Data from Web Into Excel Using VBA
    By gurs in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-31-2015, 06:26 PM
  4. Scraping data and pre-processing in one go?
    By xteejx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2014, 02:41 PM
  5. Scraping Data using VBA
    By Nala2355 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2011, 11:21 AM
  6. Data scraping
    By brewers7 in forum Excel General
    Replies: 8
    Last Post: 02-06-2011, 12:45 AM

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