Hey Kat,

I am sorry but i didn't get the logic of this code which is totally 
different from your above query,Things which i understand its just checking 
whether file_name following the criteria or not,

if 9th letter of the file name is equal to R then do something else show 
error in all columns.

try this : 


Sub Test()
Dim rw As Integer
Dim fso As Object
Dim oFolder As Object
Dim F As Object
Dim sf As Object
Dim col As Integer
Dim i As Integer
Dim fil As Object

rw = 2 ' first row
Set fso = CreateObject("scripting.filesystemobject")
Set oFolder = fso.GetFolder("E:\Macros_Collection\")
i = 1
Cells(i, 1) = "Master Folder"
Cells(i, 2) = "Location"
Cells(i, 3) = "File name"
Cells(i, 4) = "Revision times"
Cells(i, 5) = "Date Modified"
Cells(i, 6) = "Revision times"
Cells(i, 7) = "Date Modified"
Cells(i, 8) = "Revision times"
Cells(i, 9) = "Date Modified"
    
For Each F In oFolder.subfolders
        Cells(rw, 1) = F.Name
        Cells(rw, 2) = F.Path
    For Each sf In F.subfolders
            Cells(rw, 3) = Left(sf.Name, 8)
            col = 4
            For Each fil In sf.Files
                If fil.Name <> "Thumbs.db" Then
                If Mid(fil.Name, 9, 1) = "R" Then
                    Cells(rw, col) = Mid(fil.Name, 10, InStrRev(fil.Name, 
".") - 10)
                    Else
                    Range(Cells(rw, col), Cells(rw, 9)) = "error"
                End If
                End If
                     rw = rw + 1
            Next fil
            
        Next sf
 Next F
 
End Sub


   

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to