joshua-r2 of VBA Macros
10/5/2015 - 3:27 PM

Find a String in Cell After X

Find a String in Cell After X

'*******************************************************************************************************************************
'FindCellWithString
' Given a column,  a String to search for, and an anchor point, returns the first Range where that string is held after the anchor
Public Function FindRangeWithString(sSearchTerm As String, sAfterRange As String, wsSheet As Worksheet) As Range
    On Error GoTo 0
    Set FindRangeWithString = wsSheet.Cells.Find(What:=sSearchTerm, After:=wsSheet.Range(sAfterRange), SearchDirection:=xlNext)
End Function