View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
theSquirrel theSquirrel is offline
external usenet poster
 
Posts: 27
Default Do we have time for yet another Sort problem?

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?