Function HTML_Table_To_Excel() Dim htm As Object Dim tr As Object Dim td As Object Dim Tab1 As Object Column_Num_To_Start = 1 iRow = 1 iCol = Column_Num_To_Start iTable = 0 '1-31 For dan = 1 To 31 'Replace the URL of the webpage that you want to download 'Web_URL = "https://radio.hrt.hr/drugi-program/sto-svira/2020/1/8/" Web_URL = "https://radio.hrt.hr/drugi-program/sto-svira/2020/1/" & dan & "/" 'Create HTMLFile Object Set HTML_Content = CreateObject("htmlfile") 'Get the WebPage Content to HTMLFile Object With CreateObject("msxml2.xmlhttp") .Open "GET", Web_URL, False .send HTML_Content.body.innerHTML = .responseText 'this is the highlighted part for the error End With ''''''' ovo ti treba samo u slucaju daimasvise tabela 'Loop Through Each Table and Download it to Excel in Proper Format 'For Each Tab1 In HTML_Content.GetElementsByTagName("table") With HTML_Content.GetElementsByTagName("table")(iTable) For Each tr In .Rows For Each td In tr.Cells Sheets(1).Cells(iRow, iCol).Select Sheets(1).Cells(iRow, iCol) = td.innertext iCol = iCol + 1 Next td iCol = Column_Num_To_Start iRow = iRow + 1 Next tr End With ' iTable = iTable + 1 'iCol = Column_Num_To_Start 'iRow = iRow + 1 'Next Tab1 Set htm = Nothing Set tr = Nothing Set td = Nothing Set Tab1 = Nothing Next dan MsgBox "gotovo" End Function