Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting in Excel
Message
From
29/01/2004 17:11:59
 
 
To
29/01/2004 14:01:20
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00871887
Message ID:
00872087
Views:
33
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
Map
View

Click here to load this message in the networking platform