Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following procedure on a worksheet. It's intention is to sort the
rows on the sheet by a value in the score column. The rows are set up as outline rows, so you have a high level row and several rows underneath. The outline column is just a means to keep the low level lines together with the high level they belong to. When I run the procedure, instead of ordering the rows by score, it orders them by outline. I can manually sort them back to score, but when run programatically it completely ignores sorting by score. The scores are all different numbers and you can see the values in no particular order after the sort. I ensures the area is correct and it seems to run the sort, but not correctly. Any idea why this may be? Thanks! Private Sub cmdScoreSort_Click() 'sort Sheet Dim sAddress As String DisableScreenUpdates sAddress = Selection.Address 'get rid of outline Me.Cells.ClearOutline 'Sort first by score, then by outline Me.Range(Me.Cells(TOP_ROW - 1, 1), Me.Cells(Me.Cells(Rows.Count, RPT_SCORE_COL).End(xlUp).Row, RPT_OUTLINE_COL)).Sort _ key1:=Me.Cells(TOP_ROW - 1, RPT_SCORE_COL), order1:=xlDescending, _ key2:=Me.Cells(TOP_ROW - 1, RPT_OUTLINE_COL), order2:=xlAscending, header:=xlYes 'Re-add the outline to each line For inx = TOP_ROW To Me.Cells(Rows.Count, RPT_SCORE_COL).End(xlUp).Row If Me.Cells(inx, RPT_PC_COL) = "" Then Me.Rows(inx).OutlineLevel = 2 End If Next Me.Outline.ShowLevels 1 Me.Range(sAddress).Select EnableScreenUpdates End Sub -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting gives odd results | New Users to Excel | |||
COUNTIF provides weird results | Excel Worksheet Functions | |||
Weird Sorting Behavior | Excel Programming | |||
Query Table - weird results | Excel Programming | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |