#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default AUTOSORTING

Can any1 help me with telling me a macro to autosort a list right after I
make a new entry in a new row or within the array
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default AUTOSORTING

Personally, I wouldn't sort my data after I made an entry. If I made a typo,
who knows where that row would go.

But you can make sorting the data easier...

In xl2003, you can apply data|filter|autofilter to the range and use the
dropdown arrow to sort your data.

Debra Dalgleish has a technique at her site that adds invisible rectangles in
the headers and then sorts the data by that field when you click on one of those
rectangles.

http://contextures.com/xlSort02.html

FARAZ QURESHI wrote:

Can any1 help me with telling me a macro to autosort a list right after I
make a new entry in a new row or within the array


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default AUTOSORTING

I agree with Dave's opinion about not autosorting, but if you want to
proceed with despite his warnings, here's the code to do it. Put the
following code in the worksheet module (right-click the worksheet tab that
you want to sort) and paste in the following code. Change SORT_COLUMN to
the column number that you will be enter data into. Change header:=xlGuess
to either xlNo or xlYes, depending on whether your column has a header that
should not be sorted.


Private Sub Worksheet_Change(ByVal Target As Range)
Const SORT_COLUMN = 1 '<<<< CHANGE AS NEEDED
If Target.Columns.Count 1 Then
Exit Sub
End If
If Target.Column = SORT_COLUMN Then
Application.EnableEvents = False
Me.UsedRange.Sort key1:=Me.Cells(1, SORT_COLUMN),
order1:=xlAscending, _
header:=xlGuess
Application.EnableEvents = True
End If
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"FARAZ QURESHI" wrote in message
...
Can any1 help me with telling me a macro to autosort a list right after I
make a new entry in a new row or within the array



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
Need help autosorting information into different cells Shukumi Excel Discussion (Misc queries) 1 July 29th 06 09:53 PM
Autosorting Information Rosc076 Excel Worksheet Functions 0 June 27th 06 08:10 PM
autosorting to a leaderboard ano Excel Discussion (Misc queries) 1 December 2nd 05 04:17 PM


All times are GMT +1. The time now is 08:48 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"