![]() |
How do I paste a set of folder NAMES into a set of cells?
Set a reference to the Microsoft Scripting Runtime
<- wrote in message news:... This returns a listing of subfolders and their subfolders, etc, from a root directory. Sub ListSubFolders() Dim f As New Collection Call GetSubfolders("C:\MyRoot", f) Dim i As Integer For i = 1 To f.Count Range("A50000").End(xlup).Offset(1).Value = f(i) Next End Sub Function GetSubfolders(ByVal sFolderRoot As String, ByRef cSubfoldersFound As Collection) Dim oFso As FileSystemObject Set oFso = New FileSystemObject Dim oSubfolder As Folder Dim sFoldername As String Dim nextrow As Long For Each oSubfolder In oFso.GetFolder(sFolderRoot).SubFolders sFoldername = oSubfolder.Path cSubfoldersFound.Add sFoldername, sFoldername Call GetSubfolders(oSubfolder, cSubfoldersFound) Next End Function "Jedi Leba" wrote in message ... I have a set of folders that I will be using Excel to describe the contents of them. I'd like to be able to paste the folder names into the spreadsheet rather than re-type all of them. I'm pretty sure there's a way to do it, but can't figure it out. Please help! |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com