473,811 Members | 2,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Get Excel 2007 "Sort By" ??

7 New Member
Hello,

Is there a way to get Excel 2007 "sort by" value from a cell range??

to be more clear, if column header is country and you sorted cell range (A1,A10) by country, is there a way to get "country" using C#???

Thanks.
Jan 18 '09 #1
2 1526
SammyB
807 Recognized Expert Contributor
It is frustrating that the sort dialog, xlDialogSort, knows this information, but mere mortals do not have access to it. There are three ugly ways that I can think of:
(1) briefly show the dialog and use API calls to retrieve the text from the dialog, but speaking from experience, you will get gray hairs doing this and the users will wonder what flashed up on the screen.
(2) examine the columns of data in code and determine which one is sorted, but if the data is already sorted, this will not get the users last sort operation.
(3) if you are only doing the sort in code, keep track of it yourself. You can even stash this information in a custom doc property, so you can retrieve it when opening a workbook.
Jan 19 '09 #2
ronnysaid
7 New Member
SammyB , thank you for your answer, i posted this question on many forums, all started guessing, this the only answer i needed, thank you very very much for your help.

According to the method i followed earlier,the way is to examine the data itself by getting the sort address from user last sort operation, i think this workaround did it for me but i thought there is an easier way to do it, i hate microsoft for not supporting this property.

thank you again, appreciated.
Jan 20 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2213
by: Arnaud | last post by:
Hi, I work with php 4.3.4 and I don't understand the way php sort this array for example : <? $array = (-1, 30, "test", true); sort($array); var_dump($array); ?>
0
1481
by: anders thoresson | last post by:
Is it possible to resort the rows in a table like in a query where using ORDER BY, but have to new sort order stored in the table structure? -- anders thoresson -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@freebsd.csie.nctu.edu.tw
2
7317
by: Peter S. Guild | last post by:
Hello, I have a simple routine that uses a dataview to hold information. I need to sort these columns by section and then by desc. No matter what I do the dataview will not sort. What am I doing wrong? Language is C# ..Net framework is 1.1
15
1907
by: wizofaus | last post by:
I have a chunk of code which is essentially IDbCommand cmd = db.CreateCommand(); cmd.CommandText = "SELECT X, Y, Count(*) FROM Foo WHERE Z = 1 GROUP BY X, Y"; using (IDataReader reader = cmd.ExecuteReader()) while (reader.Read()) { // grab values from query }
6
1460
by: Howie | last post by:
This must be a permissions issue. But I don't know how to fix it. I am in the middle of writing a database so I haven't even learned how to deal with security yet. Could someone tell me how to stop "sort ascending" in a table being greyed-out? Much appreciated. Thanks. -- Pontins History E-Mail: usenet@pontinshistory.co.uk Please visit www.pontinshistory.co.uk
5
2035
bartonc
by: bartonc | last post by:
By that I mean they stop evaluation at the first True part of the expression. I use it often to replace an uninitialized object. Like this: >>> aString = "" >>> aString or "Hello, world" 'Hello, world' >>> anObject = None >>> anObject or range(5) >>> anObject = dict(a=1) >>> anObject or range(5)
1
1029
by: Dick Moores | last post by:
>>() is () True False Why? Thanks, Dick Moores
16
2639
by: Michael Bell | last post by:
I did an the Open University course MT262. I got 3/4 the way through it and only really came unstuck at classes. Following the advice of many, on this list and elsewhere, and impressed by their statement that students were writing substantial programs within a day, I bought "Accelerated C++" by Koenig and Moo. I find I just can't get on with it. I have started at the beginning, and I just can't follow it. The first few chapters do...
3
2711
by: bky88 | last post by:
Hi all! I need some help with a csv file im exporting. The file is coming like this: 000050222,1,AB2500AW,2007,10,32,2,+1.00 and i need to enclose some colums with double quotes so the file could look like this: 000050222,"1","AB2500AW","2007","10","32","2","+1.00"
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3876
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.