I have a problem with a macro that I am trying to make. You should look for a range of values that I give you in all the excel sheets and you should return the name of the sheets in which each value of the range appears. the error occurs when compiling returning
Run-time error '13' Type mismatch
Sub findRecurrence()
Dim ws As Worksheet
Dim strSearch As Range
Dim rngSearch As Range
Dim rngFound As String
Dim i As Integer
Dim xAddress As String
xAddress = Application.ActiveWindow.RangeSelection.Address
Set strSearch = Application.InputBox("Lookup values :", "Kutools for Excel", xAddress, Type:=8)
For Each ws In Worksheets
Set rngSearch = ws.Cells.Find(What:=strSearch)
If Not rngSearch Is Nothing Then
i = i + 1
If i = 1 Then
rngFound = rngSearch.Worksheet.Name
Else
rngFound = rngFound & ", " & rngSearch.Worksheet.Name
End If
End If
Next ws
MsgBox "'" & strSearch & "' found on the following worksheet(s): " & rngFound & "."
End Sub