Hi,
I am interested in writing a macro using VBA to loop through the file names within a folder and delete all files that are not named a specific file name. In the example below, I would like the macro to delete all files that are not named "Prepaid Maintenance.xlsx". So far, the only way I've been able to manage this is by creating a line of code to delete the files that are not named "Prepaid Maintenance.xlsx". Is there a better way to go about this?
I am interested in writing a macro using VBA to loop through the file names within a folder and delete all files that are not named a specific file name. In the example below, I would like the macro to delete all files that are not named "Prepaid Maintenance.xlsx". So far, the only way I've been able to manage this is by creating a line of code to delete the files that are not named "Prepaid Maintenance.xlsx". Is there a better way to go about this?