Hi,
I'm trying to delete a file, running VBA code where:
based on a cell value, the program looks for a file with the same name and then deletes it.
Here it looks for INACTIVE files, moves 1 cell to the right and then deletes the appropriate files from a folder.
This is the code I've implemented so far:
Sub delete_INACTIVE_files()
Dim r As Range
Dim path As String
Dim file_name As String
Dim actsh As Worksheet
Set actsh = ActiveSheet
Application.ScreenUpdating = False
Set r = ActiveSheet.Cells(1, 1)
Do Until r = ""
If UCase(r.Value) Like "INACTIVE" Then
ActiveCell.Offset(0, 1).Select
'I don't know how to insert the file name in the kill function
Kill ("C:\Users\NikolouzosD\AppData\Local\Temp\vbakillfunction\" & file_name)
End If
Set r = r.Offset(1, 0)
End If
End Sub