Prev Previous Post   Next Post Next
  #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



 
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:15 PM.

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

About Us

"It's about Microsoft Excel"