Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
Name of files in a folder Irfan Khan[_2_] Excel Discussion (Misc queries) 2 August 26th 08 08:32 AM
Count files in a folder Wanna Learn Excel Discussion (Misc queries) 4 July 9th 08 05:46 PM
Copying all files in a folder to new folder michaelberrier Excel Discussion (Misc queries) 2 June 20th 06 05:35 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 04:28 PM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Đ2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"