View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Pritchard[_3_] John Pritchard[_3_] is offline
external usenet poster
 
Posts: 16
Default Sort Failing on Some Data

The following failed to sort just two rows (in over 1600) in the data:-

Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Key2:=Range("E1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom

I identified the two rows where the data in D and E looked exactly the same
but had remained separated by the sort. Simply typing over the data in E1
resulted in sort working correctly - both were in general format - and the
data was a simple number i.e. 21100. There where links in the sheet but these
weren't linked cells nor were they the result of any calculation / formula.
Preceding the Sort statement above with :-

For Each c In ActiveSheet.Range("A1:V" & LastInRow)
c = c.Value
Next c

Also fixed the problem. Has anybody ever come across anything like this ?? -
it's well weird and if I'd not seen it myself I'd find it hard to believe.