Following the instructions on this older stackflow question, I tried to run my macro with the following code:
Sub ay1() Dim fileName, Pathname As String Dim wb As Workbook Pathname = "https://stackoverflow.com/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 tried to save this in a “master workbook” that is macro-enabled in the same directory where all my .csv files are located. Then I clicked run macro and selected ay1.
For some reason this is not running on any of my files and I’m wondering why this may be the case. I’m not getting any errors, and nothing is done to my files either.
Any help or guidance would be greatly appreciated.