General information
Category:
COM/DCOM and OLE Automation
Thanks Tamar. As always you've been a great help.
I was able to get the following code to work.
xlDescending = 2
oSheet.Range("A6:W155").Sort(oSheet.Range("D6"),xlDescending)
but the actual task is a little more complicated. Actually I want to sort on 2 columns (both numeric) and the seemingly obvious line:
oSheet.Range("A6:W155").Sort(oSheet.Range("D6"),xlDescending,;
oSheet.range("E6"),xlDescending)
does not work.
The macro code is:
Selection.Sort Key1:=Range("D6"), Order1:=xlDescending, Key2:=Range("E6") _
, Order2:=xlAscending, Header:=xlNo, OrderCustom:=1,MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
but I wasn't able to get it to work even by substituting the additional parameters as in:
oSheet.Range("A6:W155").Sort(oSheet.Range("D6"),xlDescending,oSheet.range("E6"),xlDescending,2,1,"False",1,0,0)
Is there an obvious issue here that I'm missing?
On the other hand perhaps it would be easier to sort the records before I send them to excel. The problem is FoxPro sorts on the sum of the two fields. If I convert the numbers to strings I get a funky result because of the way multi diget numeric strings sort. Got any more ideas?
Thanks again.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only