Objective: Loop through all files in a folder, and for each file, apply a filter based on Column 1 = "A". Then save over the ActiveWorkbook with the filter applied.
The below times out at ActiveSheet.Range("A1").AutoFilter Field:=1, Criteria1:="A" and i'm not sure why
Sub FilterApply()
Dim folderName As String
Dim filelocation As String
Dim FSOLibrary As Object
Dim FSOFolder As Object
Dim FSOFile As Object
Dim TargetWB As Workbook
'Set the file name to a variable
folderName = "X:\"
filelocation = "X:\"
'Set all the references to the FSO Library
Set FSOLibrary = CreateObject("Scripting.FileSystemObject")
Set FSOFolder = FSOLibrary.GetFolder(folderName)
Set FSOFile = FSOFolder.Files
'Apply Autofilter to all sheets in FSOFolder
For Each FSOFile In FSOFile
If Not ActiveSheet.AutoFilterMode Then
ActiveSheet.Range("A1").AutoFilter Field:=1, Criteria1:="A"
ActiveWorkbook.Save
End If
Next