title: VBA Scripting: QueryTable in a loop doesn't leave retrieved text in cell
body: <p>VBA noob here (just started using it yesterday) on Excel 2007, and I'm trying to map user names to full names using QueryTables and a loop. </p>
  
  <p>I have most of it done, it's just that as it runs, it fills in the cell correctly, but when it gets to the next cell, it clears the contents of the cell above it. Basically, I see the names "traveling" down the list, and at the end I just have one name at the very bottom.</p>
  
  <p>My table starts like this:</p>
  
  <pre><code>| user name | full name  |
  | psmith    |            |
  | duane     |            |
  | susanl    |            |
  </code></pre>
  
  <p>My table is supposed to look like this after I run the macro:</p>
  
  <pre><code>| user name | full name     |
  | psmith    | Peter Smith   |
  | duane     | Duane Roberts |
  | susanl    | Susan Li      |
  </code></pre>
  
  <p>But instead I get this as it runs (pretend it's like an animation):</p>
  
  <pre><code>| user name | full name     |
  | psmith    | Peter Smith   |
  | duane     |               |
  | susanl    |               |
  
  | user name | full name     |
  | psmith    |               |
  | duane     | Duane Roberts |
  | susanl    |               |
  
  | user name | full name     |
  | psmith    |               |
  | duane     |               |
  | susanl    | Susan Li      |
  </code></pre>
  
  <p>My code looks like:</p>
  
  <pre><code>Dim rngUserName As Range
  Dim userName As String
  
  Set rngUserName = ActiveSheet.Range("D2")
  
  Do Until IsEmpty(rngUserName.Offset(0, -1))
      userName = rngUserName.Offset(0, -1).Value
      With Worksheets(1).QueryTables.Add(Connection:= _
          "URL;http://mysite.com/scripts/cgi-bin/map_name.cgi?" &amp; userName, _
          Destination:=rngUserName)
          .Name = "map_name.cgi?" &amp; userName &amp; "_1"
          .FieldNames = False
          .RowNumbers = False
          .FillAdjacentFormulas = True
          .PreserveFormatting = True
          .RefreshOnFileOpen = False
          .BackgroundQuery = True
          .RefreshStyle = xlOverwriteCells
          .SavePassword = False
          .SaveData = True
          .AdjustColumnWidth = True
          .RefreshPeriod = 0
          .WebSelectionType = xlAllTables
          .WebFormatting = xlWebFormattingNone
          .WebPreFormattedTextToColumns = False
          .WebConsecutiveDelimitersAsOne = True
          .WebSingleBlockTextImport = False
          .WebDisableDateRecognition = False
          .WebDisableRedirections = False
          .Refresh BackgroundQuery = True
      End With
  
      Set rngUserName = rngUserName.Offset(1, 0)
  Loop
  </code></pre>
  
  <p>Why is the retrieved text not sticking?? It's driving me nuts and Google isn't helping...</p>
  
  <p>Thanks!!</p>