![]() |
Count files in a Folder!
Speed,
Here's a simple little function to do it Function FileCount(FolderName As String, _ Optional FileFilter As String = "*", _ Optional FileType As MsoFileType = msoFileTypeAllFiles) As Long With Application.FileSearch .NewSearch .LookIn = FolderName .SearchSubFolders = False ' True to include subfolders .Filename = FileFilter .MatchTextExactly = True .FileType = FileType .Execute FileCount = .FoundFiles.Count End With End Function Call it like x = FileCount ("C:\MyTest" for all file types, or x = FileCount("C:\myTest",,msoFileTypeExcelWorkbooks) just for Excel workbooks -- HTH Bob Phillips "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 11:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com