Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
J Brydle
 
Posts: n/a
Default Automatic Alphabetize

Hi everyone. I need a little help.

I have a spreadsheet with a name column, and 4 or 5 other columns in each
record associated with the name. I want to have these records sorted
alphabetically by the name either as they are being added, or when the
spreadsheet is saved. I know the sort button works just fine, but this is a
request from the boss, and the boss wants it to be automatic. Is there any
way to do this, or do I just have to drill it home that the sort button is
good enough?

Using Office 2003.

Thanks a lot,
JBrydle
  #2   Report Post  
Posted to microsoft.public.excel.misc
Miguel Zapico
 
Posts: n/a
Default Automatic Alphabetize

You may record a macro with what you do for sorting, and then edit that macro
in the Visual Basic Editor (Alt+11) and move the code to the
Workbook_BeforeSave event (open "ThisWorkbook" from the project explorer,
select "workbook" in the (General) dropdown and "BeforeSave" in the
(Declarations) dropdown)
That will launch that code before the workbook is saved, check if the
recorded macro behaves as expected, you may need to tweak the code.

About doing it after every row added automatically, there is an event in the
worksheet called Worksheet_change, that will be executed after every change.
You may need a lot of tweaking of the code to make it more useful that
annoying with that event, I would keep the sort button for that case (or
assign the sort macro to a custom button, your boss may like it better, who
knows)

Hope this helps,
Miguel.

"J Brydle" wrote:

Hi everyone. I need a little help.

I have a spreadsheet with a name column, and 4 or 5 other columns in each
record associated with the name. I want to have these records sorted
alphabetically by the name either as they are being added, or when the
spreadsheet is saved. I know the sort button works just fine, but this is a
request from the boss, and the boss wants it to be automatic. Is there any
way to do this, or do I just have to drill it home that the sort button is
good enough?

Using Office 2003.

Thanks a lot,
JBrydle

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dominic
 
Posts: n/a
Default Automatic Alphabetize

LOL. What the boss wants...

You could creat a macro and tie it to the workbook save event. Not sure if
this is the best way to do it but...

Sub SortByName()
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
End Sub

Put this code into your Workbook:BeforeSave area in the Visual Basic Editor.

This code assumes that the list starts in cell A1 and that the name column
is column A.

HTH.

"J Brydle" wrote:

Hi everyone. I need a little help.

I have a spreadsheet with a name column, and 4 or 5 other columns in each
record associated with the name. I want to have these records sorted
alphabetically by the name either as they are being added, or when the
spreadsheet is saved. I know the sort button works just fine, but this is a
request from the boss, and the boss wants it to be automatic. Is there any
way to do this, or do I just have to drill it home that the sort button is
good enough?

Using Office 2003.

Thanks a lot,
JBrydle

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
enable automatic refresh Vass Excel Worksheet Functions 2 March 11th 06 04:36 AM
Please help with adding automatic data. tnnt Excel Discussion (Misc queries) 1 March 8th 06 09:42 AM
options to update automatic links Werner Rohrmoser Excel Worksheet Functions 0 November 10th 05 12:58 PM
How can I find automatic links in an Excel-sheet? Tobias Excel Discussion (Misc queries) 4 August 4th 05 09:02 AM
find automatic page breaks Reason Excel Worksheet Functions 1 April 15th 05 06:03 AM


All times are GMT +1. The time now is 11:21 AM.

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"