ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count files in a Folder! (https://www.excelbanter.com/excel-programming/276769-re-count-files-folder.html)

SpeeD72

Count files in a Folder!
 
Hi Don.

Thanks a lot. But, if instead of the message Box the
value "returns" to a cell, how would the programing Be?

Thankīs a lot!!
SpeeD



-----Original Message-----
try this

Sub filescount()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\a"
.SearchSubFolders = True
.Filename = "*.*"
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
' For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i)
' Next i
Else
MsgBox "There were no files found."
End If
End With


End Sub
"SpeeD72" wrote in message
...
Hi guys.

How can a make a formula that gives me the "count" of
files in a Folder?

If it insīt possible in a formula can i make a macro that
gives me this "Count" in a cell? how?

Thanks a lot
SpeeD72


.


Don Guillett[_4_]

Count files in a Folder!
 
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."

range("a1")=.foundfiles.count

"SpeeD72" wrote in message
...
Hi Don.

Thanks a lot. But, if instead of the message Box the
value "returns" to a cell, how would the programing Be?

Thankīs a lot!!
SpeeD



-----Original Message-----
try this

Sub filescount()
Set fs = Application.FileSearch
With fs
.LookIn = "C:\a"
.SearchSubFolders = True
.Filename = "*.*"
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
' For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i)
' Next i
Else
MsgBox "There were no files found."
End If
End With


End Sub
"SpeeD72" wrote in message
...
Hi guys.

How can a make a formula that gives me the "count" of
files in a Folder?

If it insīt possible in a formula can i make a macro that
gives me this "Count" in a cell? how?

Thanks a lot
SpeeD72


.





All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com