sorting errors on repeated sort

jparker9

New Member
Joined
Nov 15, 2009
Messages
5
My sort routine produces errors after being used four times. The procedure has been in use for several years with no problems.

Public Sub SortPlayer4()
Range("A11:F154").Select
Range("F11").Activate
Selection.Sort Key1:=Range("F11"), Order1:=xlDescending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

The "F" Column is numeric from formulas and does not contain any blanks

The error is fairly consistant. It moves a row midway down the range to the 17th row where it does not belong. Although this isn't always the case.

I have retyped the formula and sometimes this will allow it to work.
I have copied the formula from a backup copy of the program and this sometimes solves the problem. But it always comes back.

I have reinstalled Excel, but still have the problem.

I have the program installed on three computers and they all produce the same error after about 4 repititions.

In all cases the data is constantly being changed via cuting and pasting so I don't think it is in the data itself.

Any ideas will be appreaciated.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello and welcome to MrExcel.

Perhaps it should be

Code:
Public Sub SortPlayer4()
Range("A11:F154").Sort Key1:=Range("F11"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub
 
Upvote 0
Hello

Try using Header:=xlYes or Header:=xlNo, depending.

Wigi
 
Upvote 0
Tried your idea re header. I think it is working. I have only run two test, but both were perfect. Will test more and get back to you. Fingers are crossed. Thanks a million
 
Upvote 0
ran program 100 times using the correction in Header:=xlNo and the program sorted correctly every time.

thanks again for our help
:LOL:
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,239
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top