Hi all,
I use a function to search a string in a range. My users now complain it messes up the find-replace options (ctrl+F)
Is there a way to remember these settings and correct them after range.find is used?
Function used
I use a function to search a string in a range. My users now complain it messes up the find-replace options (ctrl+F)
Is there a way to remember these settings and correct them after range.find is used?
Function used
Code:
Function FindStringInRange(SearchInRange As Range, SearchFor As String, Optional AfterCell) As Range
Application.ScreenUpdating = False
If IsMissing(AfterCell) Then
With SearchInRange
Set lastcell = .Cells(.Cells.Count)
End With
Else
Set lastcell = AfterCell
End If
'Find in range
Set FoundCell = SearchInRange.Find(what:=SearchFor, after:=lastcell, LookIn:=xlValues, _
lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False)
Set FindStringInRange = FoundCell
End Function