hi,
i´m new to excel. i´ve created a table B16 to H25
B=name C=adr D=city E=zip ... etc.
when i insert a new name, i want to to automaticaly sort
the table by the names.
the following code only sorts B, the columns from C to H
are untouched. what is wrong ?
Private Sub worksheet_Change(ByVal Target As Range)
On Error GoTo fehler
Application.EnableEvents = False
Range("B16:H25").Select
ActiveWorkbook.Worksheets("Endstand").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Endstand").Sort.SortFields.Add Key:=Range("B16:B25"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Endstand").Sort
.SetRange Range("B15:H25")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
fehler:
Application.EnableEvents = True
End Sub
thx and regards from germany
thorsten
Bookmarks