![]() |
List Subfolders Horizontally, seperated by comma, instead ofvertically
I finally managed to do this script almost what i want:
it is listing the subfolders of a folder-name that i put in A1 But instead of having the result in Collumn B BELOW each other, i would like to have it next to each other, into 1 cell (in this case, B1), seperated by comma. Example: A1="Folder" B1="Subfolder1,Subfolder2,Subfolder3" Sub tt() Dim FSO, FO, FU, F Set FSO = CreateObject("Scripting.FileSystemObject") Set FO = FSO.GetFolder(ActiveWorkbook.Path & "/" & Range("A1")) Set FU = FO.SubFolders For Each F In FU Range("B65536").End(xlUp).Offset(1, 0).Value = Right(F, Len(F) - InStrRev(F, "\")) Next F End Sub PS: i dont need to go to a deeper level of subfolders (dont need to see what folders are in, e.g. subfolder1) |
All times are GMT +1. The time now is 10:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com