I am trying to delete old files from a folder. file names are in column C and old files are colored RGB(255,0,0) i get an error when running this code." file not found". i tried peacing different codes together but, i'm still learning.
Code:
Sub Delete_test()
Dim MyFolder As String
Dim MyFile As String
Dim cell As Variant
Dim source As Range
Set source = Range("c3:c8")
MyFolder = Sheets("Delete Revs").Range("K1").Value & "\"
MyFile = Dir(MyFolder & "\" & "*.pdf*")
For Each cell In source
If cell.Interior.Color = RGB(255, 0, 0) Then
Kill MyFile
Else
End If
Next
End Sub