ok, I know why you are getting that error. What happened is that the AverageIfs was not able to get valid calculation based on your criteria. I put in error trapping for you, here is the amended code.
Private Sub FindAverages_Click()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Dim wb As Workbook
Dim myPath As String
Dim myFile As String
Dim myExtension As String
Dim LastRow As Long
Dim WS As Worksheet
Dim Output As Worksheet
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Output = ThisWorkbook.Worksheets("Sheet1")
'Get the folder object
Set objFolder = objFSO.GetFolder(Application.ActiveWorkbook.Path)
i = 2
LastRow = FindLastRow(Output, "A")
If LastRow > 1 Then
Output.Range("A2:F" & LastRow).Clear
End If
Output.Range("B1:F1") = Array("Average", "Filtered Average", "Min", "Max", "Std Dev")
Application.ScreenUpdating = False
'loops through each file in the directory and prints their names
On Error GoTo HandleError
For Each objFile In objFolder.Files
'print file name
If (objFile.Name <> "Test-v1.xlsm") And (objFile.Name <> "~$Test-v1.xlsm") Then
Cells(i, 1) = objFile.Name
Set wb = Workbooks.Open(fileName:=myPath & objFile)
Set WS = ActiveSheet
LastRow = FindLastRow(WS, "B")
'print file path
Output.Cells(i, 2) = Application.WorksheetFunction.Average( _
WS.Range("B2:B" & LastRow))
Output.Cells(i, 3) = Application.WorksheetFunction.AverageIfs(WS.Range("B2:B" & LastRow), _
WS.Range("D2:D" & LastRow), "<7", _
WS.Range("D2:D" & LastRow), ">1", _
WS.Range("E2:E" & LastRow), "<19", _
WS.Range("E2:E" & LastRow), ">6")
Output.Cells(i, 4) = Application.WorksheetFunction.Min( _
WS.Range("B2:B" & LastRow))
Output.Cells(i, 5) = Application.WorksheetFunction.Max( _
WS.Range("B2:B" & LastRow))
Output.Cells(i, 6) = Application.WorksheetFunction.StDevP( _
WS.Range("B2:B" & LastRow))
wb.Close SaveChanges:=False
i = i + 1
End If
Next objFile
Application.ScreenUpdating = True
Exit Sub
HandleError:
MsgBox "Error - " & Err.Description & " - " & objFile.Name
Resume Next
End Sub