I am trying to create a macro which searches for the word "Routing" in all sheets of my active workbook.
When it detects the first occurrence in one of my sheets of my workbook, I want my macro to select the related cell on the corresponding sheet.
My macro returns the error message:
run-time error 1004: activate method of range class failed…
It seems this line of code generates the issue: Loc.Activate
Sub FindAndExecuteRouting()
Dim Sh As Worksheet
Dim Loc As Range
For Each Sh In ActiveWorkbook.Worksheets
With Sh.UsedRange
Set Loc = .Cells.Find(What:="Routing")
If Not Loc Is Nothing Then
Loc.Activate
End If
End With
Next
End Sub