Q:

VBA for extracting from URL

I am trying to extracting the last page Number from URL, i want to gett tge maximum Number of pages. 
bellow is my url
https://www.justdial.com/Upleta/Cosmetic-Wholesalers-in-Upleta-Lati-Plot
here bellow is VBA code i try but some where is problem
Dim sResponse As String, html As HTMLDocument
Dim url As String
Dim N As Long
Dim X As Long

        url = ActiveCell. Value
        With CreateObject("MSXML2.XMLHTTP")
            .Open "GET", url, False
            .setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
            .send
            sResponse = StrConv(.responseBody, vbUnicode)
        End With
        Set html = New HTMLDocument

        With html
            .body.innerHTML = sResponse
        ActiveCell. Offset(1, 0) = .getElementByClass("Jpag").innerText
        ActiveCell. Offset(1, 0) = .getElementById("srchpagination").innerText
        ActiveCell. Offset(0, 1).Select
        End With

please anybody help me out

A:

You can collect a nodeList of the pagination links and then take the last but one index i.e. the max page number.  You can do this with a CSS descendant combinator to target the id of the parent element and then the a tag elements within.  I use a -2 to get the correct index as the nodeList is 0 based indexing. 
Debug. Print html.querySelectorAll("#srchpagination a").item(html.querySelectorAll("#srchpagination a").Length - 2).innerText

