Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A1=name of folder B1= Subfolders,seperated by comma(Tricky Problem?)

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   Report Post  
Posted to microsoft.public.excel.programming
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...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A1=name of folder B1= Subfolders,seperated by comma (TrickyProblem?)

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default A1=name of folder B1= Subfolders,seperated by comma (Tricky Problem?)

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A1=name of folder B1= Subfolders,seperated by comma (TrickyProblem?)

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A1=name of folder B1= Subfolders,seperated by comma (TrickyProblem?)

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comma Seperated File Ricardo0303 Excel Worksheet Functions 2 April 10th 07 04:45 PM
How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user ) divya Excel Programming 3 November 30th 06 11:34 AM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
How to split a value seperated by comma? Ticktockman Excel Discussion (Misc queries) 2 March 23rd 06 04:20 PM
Problem with comma seperated list Siw H. Thorslund Excel Programming 10 February 24th 04 11:05 AM


All times are GMT +1. The time now is 01:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"