hi Marc,

I tried again with this new code. Didn't work. Please help.


Sub Dow_HistoricalData()

    Dim xmlHttp As Object
    Dim TR_col As Object, TR As Object
    Dim TD_col As Object, TD As Object
    Dim row As Long, col As Long

    Set xmlHttp = CreateObject("MSXML2.XMLHTTP.6.0")
    xmlHttp.Open "GET", "http://nseindia.com/live_market/dynaContent/live_analysis/top_gainers_losers.htm", False
    xmlHttp.setRequestHeader "Content-Type", "text/xml"
    xmlHttp.send

    Dim html As Object
    Set html = CreateObject("htmlfile")
    html.body.innerHTML = xmlHttp.ResponseText

    Dim tbl As Object
    Set tbl = html.getElementById("tab7Content")

    row = 1
    col = 1

    Set TR_col = html.getelementsbytagname("th")
    For Each TR In TR_col
        Set TD_col = TR.getelementsbytagname("td")
        For Each TD In TD_col
            Cells(row, col) = TD.innerText
            col = col + 1
        Next
        col = 1
        row = row + 1
    Next
End Sub