Following the instructions in this Stack Overflow question, I tried to run my macro with the following code:
Sub ay1()
Dim fileName, Pathname As String
Dim wb As Workbook
Pathname = "/Users/ayy/Downloads/Folder1/STATS1/"
fileName = Dir(Pathname & "*.csv")
Do While fileName <> ""
Set wb = Workbooks.Open(Pathname & fileName)
DoWork wb
wb.Close SaveChanges:=True
fileName = Dir()
Loop
End Sub
Sub DoWork(wb As Workbook)
With wb
Selection.AutoFilter
ActiveSheet.Range("$A$1:$C$191").AutoFilter Field:=3, Criteria1:="="
Range("C2:C190").Select
Selection.EntireRow.Delete
ActiveSheet.Range("$A$1:$C$96").AutoFilter Field:=3
Range("E95").Select
ActiveWorkbook.Save
ActiveWindow.Close
End With
End Sub
I saved this in a "master workbook" that is macro-enabled in the same directory where all my .csv files are located. I clicked run macro and selected ay1.
This is not running on any of my files. I'm not getting any errors.