View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
OSSIE
 
Posts: n/a
Default Alphabetical order possible? or not


Gord Dibben Wrote:
Using event code I'm sure you could get Excel to sort your entries as
you
entered them, but I would find that very annoying.

I prefer to enter my names in a column in any order and when done, sort
that
column at one go.

But here is some code to sort as you enter.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
With Target
If .Value < "" Then
Call Macro2
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

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

Right-click on the sheet tab and "View Code"

Copy/paste the event code and the macro2 into that module.

Close that module and hit ALT + Q to go back to Excel.

Start typing names in column A


Gord Dibben MS Excel MVP




On Wed, 21 Jun 2006 13:39:02 -0500, OSSIE
wrote:


can you have excel as you enter data arrange it in alphabetical order

by
last names or names?


Hi and thnak you for your help
one more question on this last name and name have to be in the same
colum correct co is it possible to have the last name on column A and
the name on B ?


--
OSSIE
------------------------------------------------------------------------
OSSIE's Profile: http://www.excelforum.com/member.php...o&userid=31638
View this thread: http://www.excelforum.com/showthread...hreadid=554258