Auto Sort

jamieleeuk

Board Regular
Joined
Feb 9, 2009
Messages
99
Hi,

Thank again in advance for any help.

What I am looking for is something which will automatically sort my data dynamically in alphabetical order. I have done this before but with numbers, but have no idea how!

My data begins in A:7 and the last cell currently in use is I:1033, however, this has the potential to be limitless (upto the last cell ofc).

The column I need to sort by is currently Column B and I can't see this ever changing. The first name is in B7 all way down to B:1033.

When I add the new person to the spreadsheet I want them (and the whole row of data) to move to the correct part of the list, dependant on the name.

Eg, if I have CHAMBERS and FREDERICKSON already in the list and I wanted to add DAVIDSON, I would expect the whole DAVIDSON row to move between the CHAMBERS AND FREDERICKSON rows.

Thanks
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi,

this is possible , but the trigger must be something.

In below example i´ve put the sort trigger into the workbook change event.
So if you now type a name into column B, as soon as you hit Enter, it will re-sort.


Excel Workbook
ABCDE
1IndexNamesomesome1etc
21hansaaa
35Jerryeee
44Jimddd
52Johnbbb
63Ronaldcc
Sheet1



Right click on the sheetname / tabname that you want this code to run in, then view code and put below code in.

If you want to trigger on another column then change Range("B2:B2000") to another column / range.
Code:
Sub Worksheet_Change(ByVal Target As Range)

   If Not Intersect(Target, Range("B2:B2000")) Is Nothing Then

        Selection.sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal

   End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top