Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have some data on a spreadsheet. The data is a list of folders that I later showing using the Treeview control. The data is the direct output of a DOS command: dir <Folder Name/a:d /b/s file.txt I am reading in the data from the file.txt file and putting it on a spreadsheet If I choose the Folder Name as "C:", that has 3 folders "Satish", "Temp" and "Satish Work", and each folder contains one sub-folder as shown below - C:\Satish C:\Satish Work C:\Temp C:\Satish\Audacity C:\Satish Work\Excel C:\Temp\Buttons Note: Each row is in one Cell, say column A. The above DOS command first lists the main folders and then one-by-one will list the sub-folders within each main folder. But, I want something like - C:\Satish C:\Satish\Audacity C:\Satish Work C:\Satish Work\Excel C:\Temp C:\Temp\Buttons I want it to list all the sub-folders within a folder before moving on to the next folder. I sort of achieved it by sorting the data using: ThisWorkbook.Worksheets(1).Range("A1:A6").Sort _ Key1:=Worksheets(1).Range("A1") But the default sort of Excel lists the data like - C:\Satish C:\Satish Work C:\Satish Work\Excel C:\Satish\Audacity C:\Temp C:\Temp\Buttons Please note that C:\Satish\Audicity has appeared after C:\Satish Work\Excel. This is because Excel sorts the data in the following order - 0 1 2 3 4 5 6 7 8 9 (space) ! " # $ % & ( ) * , . / : ; ? @ [ \ ] ^ _ ` { | } ~ + < = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Space comes before "\". Hence I have this problem. Is there any way I can make Excel sort this data in the order I want (as mentioned above)? Please help me, because the treeview that I later use uses some logic and it has to have data in the correct order. Thanks! Satish |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change default series line color order | Excel Discussion (Misc queries) | |||
Change the sort order of the filter | Excel Discussion (Misc queries) | |||
Default Sort Order | Excel Worksheet Functions | |||
how do I reset the default sort order in excel xp back to blanks . | Excel Discussion (Misc queries) | |||
how can i change the default sort order in excel? | Excel Programming |