View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default A1=name of folder B1= Subfolders,seperated by comma (Tricky Problem?)

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...