title: Import all text files in folder into Excel one at a time then move files
body: <p>I'm trying to develop a macro that does the following</p>
  
  <ol>
  <li>Imports a text file from DIRECTORY 1 into my active workbook to a particular sheet</li>
  <li>Copies the extracted data from that imported text file and pastes the values into another worksheet (I have to perform some calculations)</li>
  <li>Moves the imported file to DIRECTORY 2</li>
  <li>Go back to step 1 for the next text file in DIRECTORY 1</li>
  </ol>
  
  <p>I don't want to copy all the text files at once into one worksheet because there won't always be the same number of text files.</p>
  
  <pre><code>Sub Import()
  
      Application.ScreenUpdating = False
      Application.DisplayAlerts = False
  
  ' Clear previous data
  
      Sheet1.Activate
      ActiveSheet.UsedRange.Clear
      Range("A1").Select
  
  ' Import text file
  
      With ActiveSheet.QueryTables.Add(Connection:= _
          "TEXT;\\directory\test.txt", _
          Destination:=Range("$A$1"))
          .Name = "Data"
          .FieldNames = True
          .TextFileTabDelimiter = True
          .TextFileColumnDataTypes = Array(3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
          .Refresh BackgroundQuery:=False
      End With
  
      ActiveSheet.QueryTables(1).Delete
  
  ' Copy values to main data table
  
      Sheet3.Range("A2:P2").Copy
  
      Sheet6.Range("A" &amp; Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
  
      Sheet6.Activate
  
      Application.ScreenUpdating = True
      Application.DisplayAlerts = True
  
  End Sub
  </code></pre>
  
  <p>I've got step 2 developed, and I've got step 1 developed for just a single file. It's the looping through all the files one at a time and moving the file once the data's imported that I'm lost with. Any help would be greatly appreciated!</p>