I have a workbook with many sheets and into some I need to enter a value if the preceding cell matches a given string.
My code works for the sheets I need it to but
You need to check that the 2 ranges intersect:
Sub AllOnePool()
Dim myStr As String
Dim myPool As String
Dim sh As Worksheet
Dim cel As Range
Dim xIng As Range
myStr = InputBox(Prompt:="Input the Target Serial Number: i.e. 93127")
myPool = InputBox(Prompt:="Input the Pool to Use: ")
For Each sh In ActiveWorkbook.Worksheets
With sh
Set xIng = Intersect(.UsedRange, .Range("F:F"))
If Not xIng Is Nothing Then
For Each cel In xIng
If cel.Text = myStr Then cel.Offset(0, 1) = myPool
Next
End If
End With
Next
End Sub