Sort in Excel within Navision

I need to sort my output data in excel within navision, if I have one column i can do it with sort method in automation. But when I need to sort 3 columns in Sort method it fails. Anybody experienced with this before? Thanks

You have to select all the 3 columums before sorting. Try with worksheet.select() Method. Regards

Tried but it non sense, even I choose Range method it realy making me completely fool on sorting!!

Hi, In such situations I record macros in EXCEL that do what I need and call this macros. If it is possible you can write this code in Navision. As minimum you will know what are you looking for. Valentin Gvozdev BMI Inc.

That’s the same way I use everytime, even I got the help with Excel it still a misery… The code I use is like that maybe I am wrong at the code, xlRange:=xlWorksheet.Range(‘A1’,‘S’+IncrEntryNo); xlRange.Sort(xlWorksheet.Range(‘B1’),1,xlWorksheet.Range(‘C1’),xlRange,1,xlWorksheet.Range(‘D1’),1,1,1,0,1,1); Edited by - barcom on 2001 Mar 06 15:44:02

At first, I thought you had a typo after …Range(‘C1’). Why would you reference your variable xlRange in that range’s sort method? Then I realized that this is the Type parameter in the sort method, and maybe you were trying to use the Excel constant ‘xlRange’ (2 BTW). Maybe that’s the problem.

quote:


xlRange.Sort(xlWorksheet.Range(‘B1’),1,xlWorksheet.Range(‘C1’),xlRange,1,xlWorksheet.Range(‘D1’),1,1,1,0,1,1);


Regards, Mark Dielmann

That is the point I stopped, I know xlRange is not the correct variable and I know it is Type method. But during trial error phase I tried and put it in message. And of course problem at there, but I could not find what to put there in and which notation Regards

Why not sort the Data in Navision with the correct KEY before you output to excel? David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

Unfortunately, data is coming iut from 3 different tables. And at this time i do not have one more table whic I can define this key and sort in…And also if this problem solved I will be able to apply it to another solutions which will save for each solution a table to me… Update: xlRange:=xlWorksheet.Range(‘B1’); xlRange2:=xlWorksheet.Range(‘C1’); xlRange.Sort(xlRange,1,xlWorksheet.Range(‘C1’),xlRange2,1,xlWorksheet.Range(‘D1’),1,1,1,0,1,1); Using above lines makes my sorting for B,C,D respectively correct…But why I have to use 2 range automation ??? How can I make it in one Edited by - barcom on 2001 Mar 07 14:00:12

Hi, Maybe I’m missing something, but what’s wrong with: xlRange:=xlWorksheet.Range(‘B1:Dxx’); where xx= the rownumber of the last row? Anolis Sittard Netherlands