Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default a data ordering question


can i set a formula that i and sort a column of datas in a alphabetical
order?? please help me, in urgent.... ....


--
無聊的路人甲
------------------------------------------------------------------------
無聊的路人甲's Profile: http://www.excelforum.com/member.php...o&userid=37633
View this thread: http://www.excelforum.com/showthread...hreadid=572482

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default a data ordering question

I believe you may be better off recording a macro to do your sort?

Use Macros | Record New Macro and then go through the process of selecting
the information to be sorted and completing the sort. At that point stop
recording. Give the macro a friendly name like SortMyData or something more
meaningful to you than just Macro1

I have only seen an attempt to sort using formulas done once, and it was
done pretty well, but it was very complex.

With a macro recorded, you can sort the same group over and over. But I am
guessing that you are going to have to do this more than one time and that
the number of rows to be sorted is going to change. The macro you record
will be very literal minded and will always sort exactly the same group of
data you chose when you recorded the macro. This means that if you sorted
A1:A10 and then add to it in A11, A12 and beyond, that the new information in
A11 and A12, etc. will not be sorted by the macro.

You can fix that.

Select the data to be sorted and in the cell just above the "A" column
indicator where it usually shows you what cell you are working with, type in
a name and press the [Enter] key. Now that bunch of data to be sorted is a
'Named Range'. Don't use spaces in the name, something like MyDataTable or
ToBeSorted would be fine. Let us assume you named it ToBeSorted

Choose Macro | Macros and highlight the macro you recorded and then click on
the [Edit] button. You should see code similar to this

Range("A1:A10").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Change the ("A1:A10") in the first line shown to have the name you gave the
group of cells, ToBeSorted, so now it would look like

Range("ToBeSorted").Select

Now you can add to the list by inserting new rows inside of that range.
Just adding to the right in new columns or at the bottom will not
automatically adjust things, but inserting new rows/columns within it will
let your macro sort properly every time.

Another way to change the code would be like this, and this assumes that
column A contains part of the data to be sorted and that the upper left
corner of your area to be sorted is at A1 but this time we will presume that
you need to also sort rows all the way over to column F.

Make the code look similar to this:

Sub Macro1()
Dim anyRange As String
anyRange = "A1:" & Range("F65536").End(xlUp).Address
Range(anyRange).Select
'the sort command goes here unchanged
End Sub

I hope this helps you and that I didn't confuse you by trying to be too
helpful.


"&#28961" <&#28961, "&#32842" <&#32842," wrote:


can i set a formula that i and sort a column of datas in a alphabetical
order?? please help me, in urgent.... ....


--
無聊的路人甲
------------------------------------------------------------------------
無聊的路人甲's Profile: http://www.excelforum.com/member.php...o&userid=37633
View this thread: http://www.excelforum.com/showthread...hreadid=572482


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
Question about graphing four sets of data RawlinsCross Charts and Charting in Excel 2 January 5th 06 12:36 AM
Importing Data Jillian Excel Worksheet Functions 9 December 23rd 05 12:45 PM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"