Posts

Showing posts with the label HOT

Scrape Website Data into Excel using VBA

Image
I'll be showing you an example on how to Scrape Data from a Website into Excel Worksheet using VBA. We'll be scraping data from www(dot)renewableuk(dot)com. Please also read the privacy policy of the website before mining data. Goal: Get all data under all column headings which can be found on this website i.e. Wind Project, Region, ..., Type of Project Requirements: You need to add a reference, Microsoft HTML Object Library on your VBA project. Usage: You can call the ProcessWeb() sub directly by pressing F5 on the Microsoft Visual Basic Window. Or you can add a button on your excel worksheet then assign ProcessWeb() as the macro. VBA CODE: Function ScrapeWebPage(ByVal URL As String) Dim HTMLDoc As New HTMLDocument Dim tmpDoc As New HTMLDocument Dim i As Integer, row As Integer Dim WS As Worksheet Set WS = Sheets("DATA") 'create new XMLHTTP Object Set XMLHttpRequest = CreateObject("MSXML2.X...