ich habe eine Listbox und möchte das der Eintrag auch aus der tabelle Entfernt wird. In der tabelle der Spalte "a" befindet sich eine einmaliger lfd nummer
anbei der bisherige code der aber nicht das macht was er soll.
If MsgBox("Soll der ausgewählte Datensatz wirklich gelöscht werden?", vbYesNo) = vbNo Then Exit Sub
Dim intRow As Integer
If Index >= 0 Then
Index = UserFormTermine.Frame18.ListBox4.ListIndex
intRow = ListBox4.ListIndex + 2
Sheets("BehandlungÜbersicht").Rows(intRow).Delete Shift:=xlUp
Else
intRow = ListBox4.ListIndex + 2
Sheets("BehandlungÜbersicht").Rows(intRow).Delete Shift:=xlUp
End If
Sheets("BehandlungÜbersicht").Activate
Range("B1").Select
ActiveWorkbook.Worksheets("BehandlungÜbersicht").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BehandlungÜbersicht").Sort.SortFields.Add2 Key:= _
Range("B1:B2824"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("BehandlungÜbersicht").Sort
.SetRange Range("A2:I2824")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Gruß achim H.