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: 101
Default Weird sorting results

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
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
Sorting gives odd results Lee New Users to Excel 5 February 15th 09 02:28 AM
COUNTIF provides weird results [email protected] Excel Worksheet Functions 4 February 10th 07 04:21 PM
Weird Sorting Behavior Jim Thomlinson[_3_] Excel Programming 1 May 4th 05 04:42 AM
Query Table - weird results sandeep[_2_] Excel Programming 1 October 9th 03 06:40 AM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


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