ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can I have an Excel spread sheet alphabetize by default? (https://www.excelbanter.com/excel-worksheet-functions/123341-can-i-have-excel-spread-sheet-alphabetize-default.html)

Judith

Can I have an Excel spread sheet alphabetize by default?
 
I have an Excel spread sheet with job orders listed in alphabetical order.
Whenever I add a new order, is there a way to have Excel "insert" the new
order in its proper alphabetical place?

Jim Thomlinson

Can I have an Excel spread sheet alphabetize by default?
 
Nope... The only thing you can do is to sort after the fact.
--
HTH...

Jim Thomlinson


"Judith" wrote:

I have an Excel spread sheet with job orders listed in alphabetical order.
Whenever I add a new order, is there a way to have Excel "insert" the new
order in its proper alphabetical place?


[email protected]

Can I have an Excel spread sheet alphabetize by default?
 
Judith

If your orders are all in a single column and you are just adding
something to the cell immediately below the existing list ,this is
pretty easy to do.

You define a dynamic range, for example, say "orders", which is defined
as:

=offset(sheet1!$A$1,0,0,counta(sheet1!A"$A),1)

This makes the range db equal to column A from the top to the bottom,
assuming that only your orders are included in the column.

In the code for the worksheet, you then put:

Private Sub Worksheet_Change(ByVal Target As Range)

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

End Sub

This code will run ever time you change something on the worksheet. If
that change is the addtion of a value in the cell at the bottom of the
list of oders, then the range 'orders" grows by one row (since the
counta component of the dynamic range increases by one), then the range
"orders" will be sorted by column A in ascending order.

I suspect your actual situation will be somewhat more complicated, but,
this should get you started.

Good luck.

Ken
Norfolk, Va







Judith wrote:
I have an Excel spread sheet with job orders listed in alphabetical order.
Whenever I add a new order, is there a way to have Excel "insert" the new
order in its proper alphabetical place?




All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com