Ich habe hier eine Tabelle mit Terminen, diese enthält 13 Spalten, darunter die Spalte Aktenzeichen und Status.
Jetzt möchte ich nach einem Aktenzeichen suchen das aber nur den Status "offen" enthält oder ein anderes fest definiertes Merkmal aus dieser Tabelle hat (wird in einer Listbox festgelegt) und soll in einer Liste im Userformular ausgegeben werden.
Wie die Suche mit einem Kriterium geht kenn ich, hier meine Code:
Private Sub Suche_HautpmenüCmd6_Click()
Dim rngC As Range, strAddress As String, varSB As Variant, lngX As Long
Dim lngZ As Long
If txtsuche = "" Then Exit Sub
varSB = txtsuche
lsthm.Clear
Worksheets("Forderungen").Select
With [A2:Z65536]
Set rngC = .Find(varSB, LookIn:=xlValues, Lookat:=xlPart)
If Not rngC Is Nothing Then
strAddress = rngC.Address
Do
On Error GoTo Ende
lngX = lngX + 1
lngZ = rngC.Row
With lsthm
.AddItem Cells(lngZ, 1)
.List(.ListCount - 1, 1) = Cells(lngZ, 2)
.List(.ListCount - 1, 2) = Cells(lngZ, 3)
.List(.ListCount - 1, 3) = Cells(lngZ, 4)
.List(.ListCount - 1, 4) = Cells(lngZ, 5)
.List(.ListCount - 1, 5) = Cells(lngZ, 6)
.List(.ListCount - 1, 6) = Cells(lngZ, 7)
.List(.ListCount - 1, 7) = Cells(lngZ, 8)
.List(.ListCount - 1, 8) = Cells(lngZ, 9)
.List(.ListCount - 1, 9) = Cells(lngZ, 10)
.List(.ListCount - 1, 10) = Cells(lngZ, 11)
.List(.ListCount - 1, 11) = Cells(lngZ, 12)
.List(.ListCount - 1, 12) = Cells(lngZ, 13)
.List(.ListCount - 1, 13) = Cells(lngZ, 14)
.List(.ListCount - 1, 14) = Cells(lngZ, 15)
.List(.ListCount - 1, 15) = Cells(lngZ, 16)
.List(.ListCount - 1, 16) = Cells(lngZ, 17)
.List(.ListCount - 1, 17) = Cells(lngZ, 18)
.List(.ListCount - 1, 18) = Cells(lngZ, 19)
.List(.ListCount - 1, 19) = Cells(lngZ, 20)
.List(.ListCount - 1, 20) = Cells(lngZ, 21)
.List(.ListCount - 1, 21) = Cells(lngZ, 22)
.List(.ListCount - 1, 22) = Cells(lngZ, 23)
.List(.ListCount - 1, 23) = Cells(lngZ, 24)
.List(.ListCount - 1, 24) = Cells(lngZ, 25)
.List(.ListCount - 1, 25) = Cells(lngZ, 26)
.List(.ListCount - 1, 26) = Cells(lngZ, 27)
.List(.ListCount - 1, 27) = Cells(lngZ, 28)
.List(.ListCount - 1, 28) = Cells(lngZ, 29)
.List(.ListCount - 1, 29) = Cells(lngZ, 30)
.List(.ListCount - 1, 30) = Cells(lngZ, 31)
.List(.ListCount - 1, 31) = Cells(lngZ, 32)
.List(.ListCount - 1, 32) = Cells(lngZ, 33)
.List(.ListCount - 1, 33) = Cells(lngZ, 34)
'.List(.ListCount - 1, 34) = Cells(lngZ, 35)
End With
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address strAddress
End If
End With
lblliste.Caption = lsthm.ListCount
If lngX = 0 Then
'MsgBox varSB & " wurde nicht gefunden! ", 64, "stelle fest..."
lsthm.AddItem Cells(1, 1)
lsthm.ColumnWidths = "120"
lsthm.ForeColor = vbRed
lsthm.List(lsthm.ListCount - 1, 0) = ("Kein Eintrag gefunden")
End If
Ende:
txtsuche = ""
txtsuche.SetFocus
End Sub
Wie stelle ich jetzt den og. Code um um mit 2 Kriterien oder mehr zu suchen?
Habe hier im Forum nichts gefunden.
Vielen Dank für Eure Hilfe im Voraus!
Mfg
Gernot