AW: Find-Problem
16.12.2008 11:10:00
Erich
Hallo Stefan,
was für Werte stehen in Spalte 5? Texte, Zahlen, Datum/Zeit?
Stehen in Spalte 5 vielleicht Formeln?
ComboBox2.Value ist ein Text.
Die Suche mit Find nach Values ist formatabhängig.
Z.B. wird 0.567 nicht gefunden, wenn in der Zelle die 0,567 als 56,7% angezeigt wird.
Wenn in Spalte 5 keine Formeln stehen, suche mal nach xlFormulas statt .xlValues
Wenn in Spalte 5 Formeln stehen, du aber nach den Werten suchen willst,
empfehle ich dir den Umstieg auf Application.Match (VERGLEICH):
Private Sub ComboBox2_Click()
MsgBox "A: " & Workbooks("Test2.xls").Worksheets("Tabelle2").Columns(5) _
.Find(ComboBox2.Value, LookIn:=xlFormulas).Row
'oder
MsgBox "B: " & Application.Match(ComboBox2.Value, _
Workbooks("Test2.xls").Worksheets("Tabelle2").Columns(5), 0)
'oder (wenn du nach Zahlen suchen willst)
MsgBox "C: " & Application.Match(CDbl(ComboBox2.Value), _
Workbooks("Test2.xls").Worksheets("Tabelle2").Columns(5), 0)
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort