Find Problem
23.10.2007 08:56:00
Thomas
ich benutze folgendes Makro um Text in meiner Arbeitsmappe zu suchen:
Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ListBox1.Clear
If TextBox1 = "" Or TextBox1 = " " Then Exit Sub
Dim wks As Worksheet
Dim rng As Range
Dim sAddress As String
For Each wks In Worksheets
Set rng = wks.Cells.Find(what:=TextBox1.Text, LookIn:=xlValues, MatchCase:=False)
If Not rng Is Nothing Then
sAddress = rng.Address
Do
Application.GoTo rng, True
If Not ActiveCell.Row Mod 2 = 1 Then
If Left(rng, Len(TextBox1)) = TextBox1 Then
ListBox1.AddItem "ArchivNr. " & ActiveCell.Offset(-1, -1) & " - " & _
ActiveCell.Text
End If
End If
Set rng = Cells.FindNext(after:=ActiveCell)
If rng.Address = sAddress Then Exit Do
Loop
End If
Next wks
Sheets(1).Select
Set rng = Nothing
Application.ScreenUpdating = True
End Sub
Dabei wird allerdings nach Groß- und Kleinschreibung unterschieden. Das möchte ich aber nicht. MatchCase:=False sollte dies eigendlich abschalten. Was ist hier falsch gelaufen?