title: Excel VB use a column's cell values as variable for web scraper
body: <p>I am aware it is possible to use VB in Excel to scrape a webpage with the below:</p>
  <pre><code>Sub ImportAnalystEst()
  Dim oHtml       As HTMLDocument
  Dim oElement    As IHTMLElement
  
  Set oHtml = New HTMLDocument
  
  
  With CreateObject(&quot;WINHTTP.WinHTTPRequest.5.1&quot;)
      .Open &quot;GET&quot;, &quot;http://www.marketwatch.com/investing/stock/aapl/analystestimates&quot;, False
      .send
      oHtml.body.innerHTML = .responseText
  End With
  
  Dim wsTarget As Worksheet
  Dim i As Integer
  i = 1
  Set wsTarget = ActiveWorkbook.Worksheets(&quot;Sheet1&quot;)
  
  
  For Each oElement In oHtml.getElementsByClassName(&quot;snapshot&quot;)
    wsTarget.Range(&quot;A&quot; &amp; i) = Split(oHtml.getElementsByClassName(&quot;snapshot&quot;).Item(0).FirstChild.FirstChild.innerHTML, &quot;TD&quot;)(7)
    wsTarget.Range(&quot;A&quot; &amp; i) = Replace(wsTarget.Range(&quot;A&quot; &amp; i), &quot;&gt;&quot;, &quot;&quot;)
    wsTarget.Range(&quot;A&quot; &amp; i) = Replace(wsTarget.Range(&quot;A&quot; &amp; i), &quot;&lt;/&quot;, &quot;&quot;)
    i = i + 1
  Next
  
  
  End Sub
  </code></pre>
  <p>But I need to iterate over several webpages. To do that, I have column A in my worksheet set up with each row representing a value to be used in the URL in place of the stock as seen here:</p>
  <pre><code>http://www.marketwatch.com/investing/stock/*VARIABLE REPRESENTING COLUMN SHEET2:A:A*/analystestimates
  </code></pre>
  <p>But I don't know how to pull in and loop through each row to scrape each URL, adding the new output below the output from the previous URL.</p>
  <p>I assume it has something to do with this:</p>
  <pre><code>Dim Rng2 As Range
  Worksheets(&quot;Sheet1&quot;).Activate
  Set Rng2 = Range(&quot;A:A&quot;)
  </code></pre>
  <p>But I am lost from there. I want to output the result in column B of the same row of the url variable.</p>