Möchte gern wenn ich in Tab1 reingehe, dass sich Tab 2 sortiert.
Oder wenn ich Tab2 verlasse, dass sich das Tab2 aktualisiert.
Gruß Klausi
Option Explicit
Private Sub Worksheet_Activate()
'Tabelle2.Range("A2") = Sortierbereich (Spalte)
'1 = Aufsteigend, 2 = Absteigend
Call Sortieren(Tabelle2.Range("A2"), 1)
End Sub
Private Sub Worksheet_Deactivate()
'Tabelle2.Range("A2") = Sortierbereich (Spalte)
'1 = Aufsteigend, 2 = Absteigend
Call Sortieren(Tabelle2.Range("A2"), 2)
End Sub
Sub Sortieren(Bezug As Range, Reihenfolge As Integer)
With Tabelle2
.Range("A2", .Cells.SpecialCells(xlCellTypeLastCell)).Sort Bezug, Reihenfolge
End With
End Sub
Gruß Tino
Private Sub Worksheet_Activate()
Schülerdaten_Sortieren
End Sub
Schülerdaten_Sortieren
Application.Goto Reference:="Database"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Key3:=Range("D2"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
End Sub
Private Sub Worksheet_Deactivate() ?
nun weiss ich nicht weiter?
Vielleicht könntest Du noch mal schauen.
Gruß Klausi
Option Explicit
Private Sub Worksheet_Activate()
Call Sortieren(Sheets("Tabelle2"))
End Sub
Private Sub Worksheet_Deactivate()
Call Sortieren(Sheets("Tabelle2"))
End Sub
Sub Sortieren(meTab As Worksheet)
With meTab
.Range("Database").Sort Key1:=.Range("B2"), Order1:=xlAscending, Key2:=.Range("C2") _
, Order2:=xlAscending, Key3:=.Range("D2"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
End With
End Sub