VBA Code for Extraction of WikiTable
Some times Wikipedia consists of interesting data in tabular format and we need it for further analysis of evaluation. Coping in excel through manually is time consuming, the vba code presented below can solve this issue. The red mark code can be changed to as per your need. yx denoted rows and column where data needs to extracted. url is the wikipedia url and tblnumber is the table number (start form 0 as first table). Sub wikitable() Dim oDom As Object: Set oDom = CreateObject("htmlFile") Dim x As Long, y As Long Dim oRow As Object, oCell As Object Dim data y = 1: x = 1 url = "https://en.wikipedia.org/wiki/List_of_mobile_network_operators" tblnumber = 0 With CreateObject("msxml2.xmlhttp") .Open "GET", url, False .Send oDom.body.innerHtml = .responseText End With With oDom.GetELementsbytagNAme("table")(tblnumber) ReDim data(1 To .Rows.Length, 1 To .Rows(1).Cells.Length) For Each oRow In .Rows For Each oCell In oRow.Cells data(x, y...