Es sollen in beiliegender dynamischer Testmappe die Gesamt-Anzahl der Daten sowie die Anzahl der gefilterten Daten in der Form z.B 50 von 1600 in der Userform angezeigt werden.
02.10.2018, 08:42 (Dieser Beitrag wurde zuletzt bearbeitet: 02.10.2018, 08:42 von Kuwer.)
Hallo Derhard,
z.B. so:
Private Sub DTPicker1_Change() Filter DTPicker1.Value, DTPicker2.Value With Range("Tabelle1!_FilterDatabase") Me.Caption = .SpecialCells(xlCellTypeVisible).CountLarge - 1 & " von " & .Cells.CountLarge - 1 End With End Sub
Private Sub DTPicker2_Change() Filter DTPicker1.Value, DTPicker2.Value With Range("Tabelle1!_FilterDatabase") Me.Caption = .SpecialCells(xlCellTypeVisible).CountLarge - 1 & " von " & .Cells.CountLarge - 1 End With End Sub
ersetze mal den kompletten Code der UF durch folgenden:
Option Explicit
Private Sub CommandButton1_Click() With Tabelle1 If .FilterMode Then .ShowAllData Application.Goto reference:=.Range("A4") End With UserForm_Initialize End Sub
Private Sub DTPicker1_Change() Filter DTPicker1.Value, DTPicker2.Value UserForm_Initialize End Sub
Private Sub DTPicker2_Change() Filter DTPicker1.Value, DTPicker2.Value UserForm_Initialize End Sub
Private Sub Image5_Click() With Tabelle1 If .FilterMode Then .ShowAllData Application.Goto reference:=.Range("A4") End With UserForm_Initialize End Sub
Private Sub UserForm_Initialize() With Tabelle1.Range("A4").CurrentRegion.Columns(1) DTPicker1.Value = Application.WorksheetFunction.Min(.SpecialCells(xlCellTypeVisible).Cells) DTPicker2.Value = Application.WorksheetFunction.Max(.SpecialCells(xlCellTypeVisible).Cells) Me.Caption = .SpecialCells(xlCellTypeVisible).CountLarge - 1 & " von " & .Cells.CountLarge - 1 End With End Sub