title: Excel database from WEB in VBA
body: <p>I would like to make a database of all companies from my city in Excel from this site: <a href="http://panoramafirm.pl/szukaj/ma%C5%82opolskie,olkuski,olkusz/firmy,1" rel="nofollow noreferrer">http://panoramafirm.pl/szukaj/małopolskie,olkuski,olkusz/firmy,1</a></p>
  
  <p>There are 25 records in every page.</p>
  
  <p>The last number in link is a number of page. Here I've 114 pages and I would like to copy every record from this site to Excel.</p>
  
  <p>After 95 records something goes wrong. The 95th record is overwriting until macro ends up.</p>
  
  <pre><code>Sub dwln2()
  
      Dim IE As InternetExplorer
  
      Dim i As Integer
  
      Dim xlNowy As Worksheet
  
      Dim x As Integer
  
      i = 1
  
      Z = InputBox("Page from", "Warning", 1)
      x = InputBox("Page to", "Warning", 5)
      ActiveSheet.Name = "Olkusz" &amp; x
  
      For x = Z To x
  
          Set IE = New InternetExplorer
  
          IE.Visible = True
          IE.Navigate "http://panoramafirm.pl/szukaj/malopolskie,olkuski,olkusz/firmy," &amp; x &amp; ".html"
          Do While IE.readyState &lt;&gt; 4
              DoEvents
          Loop
          For Each el In IE.document.all
              If el.className = "noLP companyName colorBlue addax addax-cs_hl_hit_company_name_click" Then
                  Cells(i, 1) = el.Text
              End If
              If el.className = "noLP addax addax-cs_hl_hit_homepagelink_click icon-link-ext colorBlue" Then
                  Cells(i, 2) = el.innerText
              End If
              If el.className = "icon-phone addax addax-cs_hl_hit_phone_number_click noLP highlightOnHover" Then
                  Cells(i, 3) = el.innerText
              End If
  
              If el.className = "contacts" Then
                  Cells(i, 4) = el.innerText
              End If
  
              If el.className = "noLP addax addax-cs_hl_email_submit_click icon-mail titleEmail ajaxGemius colorBlue highlightOnHover" Then
                  Cells(i, 5) = el.innerText
              End If
              If el.className = "text hidePhone crl" Then
                  Cells(i, 6) = el.innerText
                  i = i + 1
              End If
          Next
  
          Set IE = Nothing
  
          Columns.Select
          Columns.EntireColumn.AutoFit
          Cells.Select
          Cells.EntireRow.AutoFit
      Next
      MsgBox "Done"
  End Sub
  </code></pre>
  
  <p>Second problem is that I don't know how to close InternetExplorer before opening next window. Is there any option to open pages in tabs?</p>