Re: Total file count in folder and subfolders
Got this to work searching only subfolders, It will be good enough.
Code
Sub R1Photos()
Dim StrFile As String
Dim objFSO, destRow As Long
Dim mainFolder, mySubFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
mFolder = "H:\Region_1\2015\ATR Site Photos and Inventory Verif" ' <<<< to be changed
Set mainFolder = objFSO.GetFolder(mFolder)
StrFile = Dir(mFolder & "*.*")
Do While Len(StrFile) > 0
Loop
For Each mySubFolder In mainFolder.SubFolders
StrFile = Dir(mySubFolder & "\*.*")
Do While Len(StrFile) > 0
count = count + 1
StrFile = Dir
Loop
Range("E28").Value = count
'MsgBox count & " : files found in folder"
Next
End Sub
Display More