Is it possible to return a range containing a "specific text"?
Example: Return all cells containing *Pick this cell* in it?
The asterisks have no particular meaning, just a way to separate from the rest of the sentence.
I have several cells containing ONLY:
#1
#2
#1-4
I would like to select all cells containing #2.
Function RangeContaining(TextToFind As String) As Range
ActiveSheet.UsedRange.Replace TextToFind, "#N/A", xlWhole
Set RangeContaining = ActiveSheet.UsedRange.SpecialCells(xlConstants, xlErrors)
RangeContaining.Value = TextToFind
End Function
Sub Test()
MsgBox RangeContaining("#2").Address(0, 0)
End Sub