mit dem diesem Macro,
Sub DatumSuchen()
Dim i
Dim lngIndex As Long
Dim lngCount As Long
ListBox1.Clear
ListBox1.ColumnCount = 2
With ThisWorkbook.Worksheets(1)
lngCount = ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
For lngIndex = 2 To lngCount
If Day(.Cells(lngIndex, 1).Value) = monatsuche.tbtag.Text And _
Month(.Cells(lngIndex, 1).Value) = monatsuche.tbMonat.Text And _
Year(.Cells(lngIndex, 1).Value) = monatsuche.tbJahr.Text Then
ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = .Cells(lngIndex, 4).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(lngIndex, 4).Value
End If
Next
End With
End Sub
bekommt man gefilterte Daten ( Tag, Monat und Jahr ) in eine Listbox dargstellt.Mit einer Listbox klappt dies auch soweit. Ich möchte jedoch mehrere Listboxen auf einmal füllen ( immer um ein Tag versetzt.
mein derzeitiger versuch sieht so aus:
Dim lngIndex As Long
Dim lngCount As Long
Dim objControl As Control
Dim objUF As Object
'ListBox1.Clear
'ListBox1.ColumnCount = 2
' textboxen und Listboxen leeren
'----------------------------------
Dim i As Integer
If TypeName(objControl) = "ListBox" Then
objControl.Clear
End If
'-----------
With ThisWorkbook.Worksheets(1)
lngCount = ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
For lngIndex = 1 To lngCount
For i = 1 To 7
If Day(.Cells(lngIndex, 1).Value) = monatsuche.tbtag.Text And _
Month(.Cells(lngIndex, 1).Value) = monatsuche.tbMonat.Text And _
Year(.Cells(lngIndex, 1).Value) = monatsuche.tbJahr.Text Then
'Controls("Listbox" & i).List = "" '
Controls("Listbox" & i).ColumnCount = 2
Controls("Listbox" & i).AddItem
Controls("Listbox" & i).ListCount = ThisWorkbook.Worksheets(1).Cells(lngIndex, 3).Value
Controls("Listbox" & i).ListCount = ThisWorkbook.Worksheets(1).Cells(lngIndex, 4).Value
Next
End With
End Sub
ich komme einfach nicht weiter damit. Egal was ich versuche es klappt einfach nicht.
Kann sich dies mal jemand von euch anschauen?
https://www.herber.de/bbs/user/133474.xls
habt schon mal rechtvielen dank für euer Interesse.
mfg thomas