Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sort by two variables at the same time | Excel Worksheet Functions | |||
How can I sort 4 fields at a time | New Users to Excel | |||
x-axis is time ... sort of | Charts and Charting in Excel | |||
Time Sort | Excel Worksheet Functions | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |