LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Do we have time for yet another Sort problem?

If u have data in A1:A16, and B1:B16 is free
Sub xSort()
For t = 1 To 16
Cells(t, 2) = Val(Cells(t, 1))
Next
Range("A1:B16").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("B1:B16").Select
Selection.ClearContents
Range("B1").Select
End Sub



"theSquirrel" skrev:

I have a worksheet with various bits of data (mostly numeric values)
but with some text type characters sparingly used. Below is an
example of the data I am working with:

0
1+x
1
5
1
1
1
2
4
1
3
3(1)
0
0
0
0

Now... if i sort it i end up getting this.
0
0
0
0
0
1
1
1
1
1
2
3
4
5
1+x
3(1)

You will notice that I have 2 values at the bottom that I would like
to see next to their corresponding number instead of sorted as text at
the bottom.

So far I have tried to format the cells containing the values as TEXT,
I have tried to use the DataOption1:=xlSortTextAsNumbers

Here is the code I am using to sort with:

Public Sub SortMain(SortColumnAndRow As String)
Set SortKey = TempList.Range(SortColumnAndRow)

SortRange.Sort Key1:=SortKey, _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Anyone have any ideas on what I can do?


 
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
Sort by two variables at the same time MS[_3_] Excel Worksheet Functions 7 October 21st 08 03:35 AM
How can I sort 4 fields at a time Deb T New Users to Excel 6 April 15th 06 12:23 AM
x-axis is time ... sort of [email protected] Charts and Charting in Excel 1 January 4th 06 01:42 AM
Time Sort Intotao Excel Worksheet Functions 9 December 6th 04 10:29 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 10:58 PM.

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"