I know this is a simple one but i can't get the correct syntax, this macro prints URLs from table from a webpage, the problem is each new table starts in Row 2, what i need is for the first table to start in Row 2 but an new tables should start at the end of the last table printed.
I have used this in the past but can't make it work in this instance.
Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Sheets("Sheet2").Range("A1").Value
I have used this in the past but can't make it work in this instance.
Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = Sheets("Sheet2").Range("A1").Value
Code:
Sub ProcessHTMLPage(HTMLPage As MSHTML.HTMLDocument)
Dim HTMLTable As MSHTML.IHTMLElement
Dim HTMLTables As IHTMLElementCollection
Dim HTMLRow As MSHTML.IHTMLElement
Dim HTMLCell As MSHTML.IHTMLElement
Dim RowNum As Long, ColNum As Integer
Dim i As Integer
Set HTMLTables = HTMLPage.getElementsByTagName("Table")
For Each HTMLTable In HTMLTables
RowNum = 2
For Each HTMLRow In HTMLTable.getElementsByTagName("tr")
ColNum = 1
For Each HTMLCell In HTMLRow.getElementsByTagName("a")
Cells(RowNum, ColNum) = vbTab & HTMLCell.getAttribute("href")
ColNum = ColNum + 1
Next HTMLCell
RowNum = RowNum + 1
Next HTMLRow
Next HTMLTable
End Sub