AW: AW:...
07.09.2009 15:56:01
Chris
Servus,
ersetze den Code für Listbox2 durch diesen:
Private Sub ListBox2_Click()
Dim LRow, strErste As String, rSuche As Range
If op1 Then
'LRow = Application.Match(ListBox2, Columns(2), 0)
'If IsNumeric(LRow) Then
Set rSuche = Range("B:B").Find(what:=ListBox2, LookAt:=xlWhole, LookIn:=xlValues)
If Not rSuche Is Nothing Then
strErste = rSuche.Address
Do
If rSuche.Offset(0, -1) = CDate(ListBox1) Then
LRow = rSuche.Row
End If
Set rSuche = Range("B:B").FindNext(rSuche)
Loop While Not rSuche Is Nothing And rSuche.Address strErste
End If
Set rSuche = Nothing
Me.tbdate.Value = Cells(LRow, 1)
Me.tbkart.Value = Cells(LRow, 2)
Me.tbbetrag.Value = Cells(LRow, 3)
'End If
Else
If op2 Then
Set rSuche = Range("A:A").Find(what:=CDate(ListBox2), LookAt:=xlWhole, LookIn:=xlValues)
If Not rSuche Is Nothing Then
strErste = rSuche.Address
Do
If rSuche.Offset(0, 1) = ListBox1 Then
LRow = rSuche.Row
End If
Set rSuche = Range("A:A").FindNext(rSuche)
Loop While Not rSuche Is Nothing And rSuche.Address strErste
End If
Set rSuche = Nothing
'If IsNumeric(LRow) Then
Me.tbdate.Value = Cells(LRow, 1)
Me.tbkart.Value = Cells(LRow, 2)
Me.tbbetrag.Value = Cells(LRow, 3)
End If
End If
End Sub
Sollte dann funktionieren.
Gruß
Chris