habe mal wieder ein Bitte bei der ich Eure Hilfe benötigen würde.
Ich habe ein Code im Einsatz mit welchen ich einen gesamte Arbeitsmappe nach bestimmten Zahlen, Namen usw. durchsuchen kann. Manchmal wäre es aber sinnvoller ein Arbeitsblatt separat zu durchsuchen um schneller an das Ziele zu kommen.
Private Sub CommandButton1_Click()
Dim strSearch As String, strFirstAddress As String
Dim objCell As Range, objWorksheet As Worksheet
Dim blnAbort As Boolean, blnFound As Boolean
Dim lngOldColor As Long
strSearch = InputBox("Suchbegriff:", "Suche nach...")
If strSearch > vbNullString Then
Do
For Each objWorksheet In ThisWorkbook.Worksheets
Set objCell = objWorksheet.Cells.Find(What:=strSearch, _
LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
If Not objCell Is Nothing Then
strFirstAddress = objCell.Address(External:=True)
blnFound = True
Do
Call Application.GoTo(Reference:=objCell)
With objCell.Interior
lngOldColor = .Color
.Color = RGB(155, 194, 230)
End With
If MsgBox("Weitersuchen?", vbQuestion Or vbYesNo, "Abfrage") = vbNo Then
objCell.Interior.Color = lngOldColor
blnAbort = True
Exit Do
End If
objCell.Interior.Color = lngOldColor
Set objCell = objWorksheet.Cells.FindNext(After:=objCell)
If objCell Is Nothing Then Exit Do
Loop Until objCell.Address(External:=True) = strFirstAddress
End If
If blnAbort Then Exit For
Next
If objCell Is Nothing And Not blnFound Then
Call MsgBox("Suchbegriff nicht gefunden.", vbExclamation, "Hinweis")
Exit Do
ElseIf Not blnAbort Then
If MsgBox("Letze Fundstelle." & vbLf & vbLf & "Nochmal von vorne?", _
vbQuestion Or vbYesNo, "Abfrage") = vbNo Then Exit Do
End If
Loop Until blnAbort
End If
End Sub
Das ist der Code. Was müsste ich einfügen um ein bestimmtes Tabellenblatt zu durchsuchen. Vielleicht kann mir Jemand einen Weg weisen.
Für Eure Hilfe danke ich Ihnen im voraus.
LG Robert