title: How to make excel backup checker script get file with newest date
body: <p>I have a program that creates backups after format: <code>&lt;name&gt;_&lt;date&gt;</code>  </p>
  
  <p>Some of them have more backups, some of them have none.  </p>
  
  <p>There are kept up to 3 backups with same name but different dates.</p>
  
  <p>I have an excel table that contains names and a script that checks if there is a backup or not, and colors the cell after the result. </p>
  
  <p>I want to improve the script, so it would check if the backup is outdated (older than 30 days).</p>
  
  <p>I have got the idea, but I ran into a problem. If there are multiple backups of the same name, I cant figure out, how to make it compare the newest of them.</p>
  
  <p>the script:</p>
  
  <pre><code>'auto check if backup exists - on click
  file = Dir("&lt;filepath&gt;")
  Do While file &lt;&gt; ""
      myBool = False
      backup = Right(backup, 6)
          If InStr(file, backup) &gt; 0 Then
              If now - FileDateTime(file) &gt; 30 Then 'this is where I have the problem... how do I make it grab the newest of the backups?
              'outdated 
              End If
  
              myBool = True
              ActiveCell.Interior.ColorIndex = "35"
              Exit Do
          End If
      file = Dir
  Loop
      If Not myBool Then
          ActiveCell.Interior.ColorIndex = "22"
      End If
  </code></pre>