title: How to count number of rows and to move files automatically with VBA macros?
body: <p>My goal is to write a VBA macros that will allow:</p>
  
  <ol>
  <li>to choose a folder with files to open </li>
  <li>then to count number of rows in each file (each file contain only 1 sheet). </li>
  <li>to move to another folder all the files that contain more than 1 row</li>
  </ol>
  
  <p>I'm very new in VBA, so what i found is how to count number of rows from active worksheet, but i still can't manage automatically files opening and moving to another folder:</p>
  
  <pre><code>Sub RowCount()
      Dim iAreaCount As Integer
      Dim i As Integer
      Worksheets("Sheet1").Activate
      iAreaCount = Selection.Areas.Count
      If iAreaCount &lt;= 1 Then
          MsgBox "The selection contains " &amp; Selection.Rows.Count &amp; " rows."
      Else
          For i = 1 To iAreaCount
              MsgBox "Area " &amp; i &amp; " of the selection contains " &amp; _
              Selection.Areas(i).Rows.Count &amp; " rows."
          Next i
      End If
  End Sub
  </code></pre>
  
  <p>Could someone help with this, please?</p>