LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Change Default Sort Order - Please Help!!!

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
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
Change default series line color order Leonard Lan Excel Discussion (Misc queries) 5 July 2nd 08 03:02 AM
Change the sort order of the filter AllYourSpam Excel Discussion (Misc queries) 5 March 10th 08 01:31 PM
Default Sort Order Jeff G Excel Worksheet Functions 4 September 3rd 06 01:17 PM
how do I reset the default sort order in excel xp back to blanks . MardiL Excel Discussion (Misc queries) 2 February 24th 05 08:15 PM
how can i change the default sort order in excel? kristenlc Excel Programming 3 September 17th 04 06:48 AM


All times are GMT +1. The time now is 06:27 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"