nach Eingabe eines Monats und Jahr soll eine Listbox eingelesen werden.
Leider passiert nichts.
Danke!
Lg Olga
Sub DatumSuchen()
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 CLng(.Cells(lngIndex, 1).Value = CLng(Month(tbMonat.Text))) And CLng(.Cells(lngIndex, 1).Value = CLng(Year(tbJahr.Text))) Then
ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = .Cells(lngIndex, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(lngIndex, 2).Value
End If
Next
End With
End Sub
Private Sub UserForm_Initialize()
tbMonat.Value = "2"
tbJahr.Value = "2017"
DatumSuchen
End Sub
https://www.herber.de/bbs/user/114190.xlsm