Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following folder structu
/Folder01/Subfolder01 /Folder01/Subfolder02 /Folder02/Subfolder01 /Folder02/Subfolder02 list_folders.xls should be in the ROOT I want the makro to read the foldernames in Column A, and as a result i would like to see the Subfolder Names in Column B (Seperated by comma) Btw. Subfolders deeper than that can be ignored - so its basically about the subfolders on "level 2". So with the above folder structure, having filled in A1&A2 before, it should look like this: A1="Folder01" B1="Subfolder01,Subfolder02" A2="Folder02" B2="Subfolder02,Subfolder02" Can anyone solve this? It seems quite tricky... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit Dim i As Long Dim LastRow As Long Dim cell As Range Dim sh As Worksheet With ActiveSheet LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row For i = LastRow To 1 Step -1 .Cells(i, "B").Value = Split(.Cells(i, "A").Value, "/")(2) .Cells(i, "A").Value = Split(.Cells(i, "A").Value, "/")(1) If .Cells(i, "A").Value = .Cells(i + 1, "A").Value Then .Cells(i, "B").Value = .Cells(i, "B").Value & "," & .Cells(i + 1, "B").Value .Rows(i + 1).Delete End If Next i End With End Sub -- __________________________________ HTH Bob "Tobi Harnegg" wrote in message ... I have the following folder structu /Folder01/Subfolder01 /Folder01/Subfolder02 /Folder02/Subfolder01 /Folder02/Subfolder02 list_folders.xls should be in the ROOT I want the makro to read the foldernames in Column A, and as a result i would like to see the Subfolder Names in Column B (Seperated by comma) Btw. Subfolders deeper than that can be ignored - so its basically about the subfolders on "level 2". So with the above folder structure, having filled in A1&A2 before, it should look like this: A1="Folder01" B1="Subfolder01,Subfolder02" A2="Folder02" B2="Subfolder02,Subfolder02" Can anyone solve this? It seems quite tricky... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanx Bob,
I get "Error 9" though.... "Index out of valid Area..." Since i am quite rookie, of course i dont exactly understand what your macro is doing, and also not if i was clear enough in my description... thats why i uploaded this xls http://sites.google.com/site/excelau...attredirects=0 It already includes your makro and also shows what results i'd like to get. (ah, and its zipped, since it also contains the folder structure to test it with) Thanks a lot, Tobias PS: I saved it in xls, but i am actually using Excel 2007 - maybe the error message is related to that? PS2: This link shows a screenshot of the results id like to have http://sites.google.com/site/excelauswahl/excel-vba |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My code is based upon the folder names being in column A as you described.
Your example shows neither folder names, nor in column A. -- __________________________________ HTH Bob "Tobi Harnegg" wrote in message ... Thanx Bob, I get "Error 9" though.... "Index out of valid Area..." Since i am quite rookie, of course i dont exactly understand what your macro is doing, and also not if i was clear enough in my description... thats why i uploaded this xls http://sites.google.com/site/excelau...attredirects=0 It already includes your makro and also shows what results i'd like to get. (ah, and its zipped, since it also contains the folder structure to test it with) Thanks a lot, Tobias PS: I saved it in xls, but i am actually using Excel 2007 - maybe the error message is related to that? PS2: This link shows a screenshot of the results id like to have http://sites.google.com/site/excelauswahl/excel-vba |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 9, 10:32*pm, "Bob Phillips" wrote:
My code is based upon the folder names being in column A as you described.. Your example shows neither folder names, nor in column A. -- __________________________________ HTH Bob "Tobi Harnegg" wrote in message ... Thanx Bob, I get "Error 9" though.... "Index out of valid Area..." Since i am quite rookie, of course i dont exactly understand what your macro is doing, and also not if i was clear enough in my description... thats why i uploaded this xls http://sites.google.com/site/excelau...t-folder.zip?a... It already includes your makro and also shows what results i'd like to get. (ah, and its zipped, since it also contains the folder structure to test it with) Thanks a lot, Tobias PS: I saved it in xls, but i am actually using Excel 2007 - maybe the error message is related to that? PS2: This link shows a screenshot of the results id like to have http://sites.google.com/site/excelauswahl/excel-vba Yess it does! The Folder Names in Root - where the workbook lies - are "01", "02", "03", and "xyz" Maybe you got mislead because i put the "Desired result" in Collum F & G but that had no meaning, i just wanted to put it next to each other for the screenshot. I entered The names into Collumn A A1="01" A2="02" A3="03" Copied your makro into modul 1, and when i execute i get No result in Collumn B except for Error 9 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 9, 11:47*pm, Tobi Harnegg wrote:
On Feb 9, 10:32*pm, "Bob Phillips" wrote: My code is based upon the folder names being in column A as you described. Your example shows neither folder names, nor in column A. -- __________________________________ HTH Bob "Tobi Harnegg" wrote in message .... Thanx Bob, I get "Error 9" though.... "Index out of valid Area..." Since i am quite rookie, of course i dont exactly understand what your macro is doing, and also not if i was clear enough in my description... thats why i uploaded this xls http://sites.google.com/site/excelau...t-folder.zip?a.... It already includes your makro and also shows what results i'd like to get. (ah, and its zipped, since it also contains the folder structure to test it with) Thanks a lot, Tobias PS: I saved it in xls, but i am actually using Excel 2007 - maybe the error message is related to that? PS2: This link shows a screenshot of the results id like to have http://sites.google.com/site/excelauswahl/excel-vba Yess it does! The Folder Names in Root - where the workbook lies - are "01", "02", "03", and "xyz" Maybe you got mislead because i put the "Desired result" in Collum F & G but that had no meaning, i just wanted to put it next to each other for the screenshot. I entered The names into Collumn A A1="01" A2="02" A3="03" Copied your makro into modul 1, and when i execute i get No result in Collumn B except for Error 9 that screenshot is probably more clear: http://5333903419338715748-a-1802744...attredirects=0 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Comma Seperated File | Excel Worksheet Functions | |||
How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user ) | Excel Programming | |||
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? | Excel Discussion (Misc queries) | |||
How to split a value seperated by comma? | Excel Discussion (Misc queries) | |||
Problem with comma seperated list | Excel Programming |