re: find stuff
Below is my Find code. It checks for no answer or a repeat find and exits.
Returns a message with the cell location of the found cells.
Modify as needed.
'---
Sub FindSomeThingExample()
'Nothing Left to Lose - March 2021
Dim SearchFor As Variant
Dim rCell As Excel.Range
Dim firstAddress As String
Dim strMessage As String
SearchFor = "|"
'Change to Excel.Selection.Cells if preferred
With ThisWorkbook.Worksheets(1).Cells
Set rCell = .Find(SearchFor, LookIn:=xlValues)
If Not rCell Is Nothing Then
firstAddress = rCell.Address 'stopping point
strMessage = rCell.Address(external:=True) 'includes sheet name
Do
Set rCell = .FindNext(rCell)
'stop searching if
If rCell Is Nothing Or rCell.Address = firstAddress Then Exit Do
'accumulate locations
strMessage = strMessage & vbCr & rCell.Address(external:=True)
Loop
End If
End With
If VBA.Len(strMessage) Then
VBA.MsgBox strMessage
Else
VBA.MsgBox "Nothing found "
End If
End Sub
'---
NLtL
https://1drv.ms/u/s!Au8Lyt79SOuhZ_2VvKCLZxz9iwI?e=vnEabM
Free: Custom_Functions, Professional_Compare and more