PDA

View Full Version : count subfolders



pandemar
10-29-2009, 12:29 PM
Hi,
I have code to count files in folders...
I need help writing vba to just count the subfolders in a folder.

thanks,

peter

MWE
10-29-2009, 03:18 PM
Hi,
I have code to count files in folders...
I need help writing vba to just count the subfolders in a folder.

thanks,

peter Welcome to the forum.

Attached please find a spreadsheet that may be of some assistance. I threw together a few subs that start at some location and work their way down through folders, subfolders, etc., counting things, storing names, etc. The procs are from a "vaulting/searching" searching application and do more than you asked for, but perhaps you eventually want to do more ... I also included a sub that allows you to navigate to a top level directory ...

If you can be a bit more specific about what you want to do, for example, count just subfolders in a folder or count subfolders, next level down, etc. I could fine tune something to do just what you need.

GTO
10-29-2009, 04:56 PM
Cross-posted: http://www.mrexcel.com/forum/showthread.php?t=426047