I am trying to do the searching for some value in all worksheets. However the code below can only do it on the first worksheet. It seems like the active sheet cannot be changed, Please help me on this issue.
Sub Search()
Dim sRange As Range, Rng As Range
Dim Row1 As Integer, Row2 As Integer
Dim FindString As String
Dim WS As Worksheet
Row1 = 13
Row2 = 2
Application.ScreenUpdating = False
FindString = Sheets("Welcome").Range("N10").Value
For Each WS In ThisWorkbook.Worksheets
If WS.Name <> "Welcome" Then
WS.Activate
LastRow2 = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
While Row2 < LastRow2
Set sRange = ActiveSheet.Range(Cells(Row2, 2), Cells(Row2, 9))
With sRange
Set Rng = .Find(What:=FindString, After:=.Cells(1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False)
If Not Rng Is Nothing Then
Sheets("Welcome").Range("N" & Row1).Value = WS.Name
Sheets("Welcome").Range("O" & Row1).Value = Rng.Row
Row1 = Row1 + 1
End If
End With
Row2 = Row2 + 1
Wend
End If
Next WS
Sheets("Welcome").Activate
Application.ScreenUpdating = True
End Sub