AW: schnelle Suche
12.12.2006 15:46:04
Erich
Hallo Otto,
zunächst ein Tipp: Es ist meist ziemlich ratsam, bei Find() alle wesentlichen Parameter anzugeben.
(Da ich nicht genau weiß, wie wonach gesucht werden soll, hab ich das jetzt nicht getan.)
Vielleicht hilft das ja schon (ohne Test wg. fehlender Testdaten):
Private Sub Sucheallg_Click()
Dim Sallg As String, zeile, begriff As Long ', begriff1 As Long
Sallg = Start.TextBox2
zeile = 0
With Worksheets("Stamm").Range("c4:cd5000")
Set c = .Find(Sallg, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
begriff = c.Row
If begriff <> begriff1 Then
Fundeallg.ListBox1.AddItem zeile 'begriff
Fundeallg.ListBox1.List(zeile, 0) = Cells(begriff, 3)
Fundeallg.ListBox1.List(zeile, 1) = Cells(begriff, 5)
Fundeallg.ListBox1.List(zeile, 2) = Cells(begriff, 25)
Fundeallg.ListBox1.List(zeile, 3) = Cells(begriff, 23)
Fundeallg.ListBox1.List(zeile, 4) = Cells(begriff, 24)
zeile = zeile + 1
begriff1 = begriff
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Fundeallg.Show
End Sub
Private Sub Bestandsuche()
' weiterer Code
With bereich
Set c = .Find(suchbegriff, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
'c.Select
fund2 = c.Row
Funde.ListBox1.AddItem fund2
Funde.ListBox1.List(zeile2, 0) = Cells(fund2, 2)
Funde.ListBox1.List(zeile2, 1) = Cells(fund2, 3)
Funde.ListBox1.List(zeile2, 2) = Cells(fund2, 5)
Funde.ListBox1.List(zeile2, 3) = Cells(fund2, 25)
Funde.ListBox1.List(zeile2, 4) = Cells(fund2, 27)
Funde.ListBox1.List(zeile2, 5) = Cells(fund2, 61)
Funde.ListBox1.List(zeile2, 6) = Cells(fund2, 35)
Funde.ListBox1.List(zeile2, 7) = Format(Cells(fund2, 33), "0.0")
Funde.ListBox1.List(zeile2, 8) = Format(Cells(fund2, 39), "0.00")
Funde.ListBox1.List(zeile2, 9) = fund2
zeile2 = zeile2 + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Funde.Show
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort