Public Sub FindText()
'Run from standard module, like: Module1.
'Find all data on all sheets!
'Do not search the sheet the found data is copied to!
'List a message box with all the found data addresses, as well!
Dim ws As Worksheet, Found As Range
Dim myText As String, FirstAddress As String
Dim AddressStr As String, foundNum As Integer
myText = InputBox("Geef een artikelnummer of een gedeelte van een artikelnummer op.", "Zoeken")
If myText = "" Then Exit Sub
For Each ws In ThisWorkbook.Worksheets
With ws
'Do not search Profieloverzicht!
If ws.Name = "Profieloverzicht" Then GoTo myNext
'Do not search Profielen!
If ws.Name = "Profielen" Then GoTo myNext
'Do not search Algemeen!
If ws.Name = "Algemeen" Then GoTo myNext
'Do not search Verwerkers!
If ws.Name = "Verwerkers" Then GoTo myNext
Set Found = .UsedRange.Find(What:=myText, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
If Not Found Is Nothing Then
FirstAddress = Found.Address
Do
foundNum = foundNum + 1
AddressStr = AddressStr & .Name & " " & Found.Address & vbCrLf
Set Found = .UsedRange.FindNext(Found)
'Copy found data row to Profieloverzicht Option!
'Found.EntireRow.Copy _
'Destination:=Worksheets("Profieloverzicht").Range("A65536").End(xlUp).Offset(1, 0)
Loop While Not Found Is Nothing And Found.Address <> FirstAddress
End If
myNext:
End With
Next ws
If Len(AddressStr) Then
MsgBox "Gevonden profielen voor " & myText & vbCr & _
AddressStr, vbOKOnly, myText & ""
Else:
MsgBox "Geen resultaten gevonden voor " & myText & "", vbExclamation
End If
End Sub