Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pulling pdf files from general folder to specific folder | Excel Discussion (Misc queries) | |||
Name of files in a folder | Excel Discussion (Misc queries) | |||
Count files in a folder | Excel Discussion (Misc queries) | |||
Copying all files in a folder to new folder | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) |