sortieren.
Ernst
ich würde eure Hilfe benötigen.
wie kann ich folgenden Code für gewünschte Rangebereiche .......ausweiten ?
Tabelle1
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Bereich1
If Not Intersect(Target, Range("A8:A45")) Is Nothing Then .........j8:j45,..s8:s45
MyCol = Target.Column
If Target = "" Then Target.Offset(, 3) = ""
MySort
If Cells(45, MyCol) = "" And Cells(8, 13) "" Then
Application.EnableEvents = False
Cells(45, MyCol) = Cells(8, 13)
Cells(45, MyCol + 3) = Cells(8, 16)
MySort
Application.EnableEvents = True
Union(Cells(8, 13), Cells(8, 16)) = ""
End If
End If
'Bereich2
If Not Intersect(Target, Range("D8:D45")) Is Nothing Then .........n8:n45..w8:w45
MyCol = Target.Column
If Target = "" Then Target.Offset(, 3) = ""
MySort
End If
End Sub
..............................................................
Modul1
Option Explicit
Public MyCol& '& = Long
Sub MySort()
Select Case MyCol
Case Is = 1 'Spalte(A)
Range("A8:D45").Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess, _ ...j8:m45,s8:v45
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Case Is = 13 ''Spalte(M)
Range("E8:H45").Sort Key1:=Range("M8"), Order1:=xlAscending, Header:=xlGuess, _..n8:q45,w8:z45
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Select
End Sub
wäre für Lösungsvorschläge dankbar.
lg.Ernst