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

Try this modification.

Either set your ENTER key to move right upon entry or use the Tab key to move
right out of column A to B

Enter last name in col A and first name in col B.

When you hit ENTER out of col B, A and B will sort by Last Name

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B1:B100")) 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:B").Sort Key1:=Range("A1"), _
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub


Gord

On Thu, 22 Jun 2006 10:20:50 -0500, OSSIE
wrote:

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 ?