![]() |
Excel vba - Druckversion +- Office-Fragen.de (https://office-fragen.de) +-- Forum: Microsoft Office (https://office-fragen.de/forum-1.html) +--- Forum: Excel (https://office-fragen.de/forum-2.html) +--- Thema: Excel vba (/thread-27409.html) |
Excel vba - Nader2022 - 21.03.2022 Hallo zusammen, folgender Code: Option Explicit Private Sub CommandButton1_Click() Unload UF_Status_Vorbestellungen End Sub Private Sub CommandButton2_Click() 'Teil (1) Pivot Tabelle aktualisieren Sheets("Tabelle4").Activate ThisWorkbook.RefreshAll 'Teil (2) Eingabe vom Datum über Inputbox Dim FindString As String Dim Rng As Range FindString = InputBox("Datum eingeben!") If Trim(FindString) <> "" Then With Sheets("Tabelle1").Range("A:A") 'searches all of column A Set Rng = .Find(What:=FindString, _ After:=.Cells(.Cells.Count), _ LookIn:=xlValues, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not Rng Is Nothing Then Application.Goto Rng, True 'value found Else MsgBox "Nothing found" 'value not found End If End With Dim num As String num = InputBox(prompt:="Datum", Title:="Datum eingeben") Sheets("Tabelle4").PivotTables("PivotTable1") _ .PivotFields("Datum").CurrentPage = num End If End Sub Private Sub UserForm_Initialize() 'Anzeigen ListBox1 Dim lLetzte1 As Long Application.ScreenUpdating = False ListBox1.Clear With Worksheets("Tabelle4") lLetzte1 = .Cells(Rows.Count, 1).End(xlUp).Row With Me.ListBox1 .ColumnCount = 2 ' ListBox1.Selected(0) = True .ColumnHeads = False .Font.Size = 18 ListBox1.RowSource = "Tabelle4!A1:K1" & lLetzte1 End With End With Application.ScreenUpdating = True ListBox1.ColumnWidths = "18,0 Cm;8,0 Cm" End Sub (1). Eingabe "Datum" mit Find und anschließende Suche in der Tabelle erfolgt, ob vorhanden oder nicht (kein Problem). (2). Danach funktioniert leider der Zugriff auf die Pivot Tabelle nicht richtig, da ich mit Abfragen nicht zurecht komme und die Aktualisierung der Pivot Tabelle nicht mehr stattfindet. Über jede auch so kleine Hilfe wäre ich sehr dankbar Vielen Dank |