Computing.Net > Forums > Office Software > Excel 2003 Auto Data Sort

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel 2003 Auto Data Sort

Reply to Message Icon

Name: DYS
Date: November 11, 2008 at 04:28:07 Pacific
OS: XP
CPU/Ram: Intel 2.4 ghz, 2mb ram
Product: HP
Comment:

I have limited Excel knowledge.

I have 2 columns, column A is names, column B is manually updated with numbers. Can I add a button or automatically data sort column B then A

Any help would be appreciated, many thanks



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: November 11, 2008 at 11:00:49 Pacific
Reply:

You can assign this code to a button or shape to sort A1:B10 with a single click:

Sub MySort()
Range("A1:B10").Sort _
Key1:=Range("B1"), Order1:=xlAscending, _
Key2:=Range("A1"), Order2:=xlAscending
End Sub

Or Right-Click your sheet tab and use it as a WorkSheet_Change macro to do it automatically:


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
Range("A1:B10").Sort _
Key1:=Range("B1"), Order1:=xlAscending, _
Key2:=Range("A1"), Order2:=xlAscending

End If
End Sub



0

Response Number 2
Name: DYS
Date: November 12, 2008 at 02:01:17 Pacific
Reply:

Many thanks DerbyDad03 used the worksheet change macro, it works fine, but when saved and file reopened it does'nt work but code still assigned to tab.
Can you suggest anything ?


0

Response Number 3
Name: DYS
Date: November 14, 2008 at 00:51:01 Pacific
Reply:

Many thanks Derbydad03, changed the Macro security setting and all works fine

your help is much appreciated


0

Response Number 4
Name: DerbyDad03
Date: November 14, 2008 at 04:16:49 Pacific
Reply:

I'm glad I could help.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Using VBA for Cond Format... MSN Live Photo



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel 2003 Auto Data Sort

Excel 2007 data bars for Excel 2003 www.computing.net/answers/office/excel-2007-data-bars-for-excel-2003/9304.html

Excel Data Sort Across Worksheets www.computing.net/answers/office/excel-data-sort-across-worksheets/838.html

Excel 2003 sorting www.computing.net/answers/office/excel-2003-sorting/7607.html