I\'m trying to perform a \"find\" in a Excel sheet with this instruction:
Set Found = Columns(2).Find(What:=value_to_find, After:=ActiveCell, LookIn:=xlFormulas,
Exactly as @barrowc commented.
This works although not sure of exact requirements:
Sub xxx()
Dim value_to_find As String
value_to_find = "fooBar"
Dim r As Range
Set r = ActiveCell.EntireColumn.Find( _
What:=value_to_find, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
MsgBox r.Address
End Sub
[RESOLVED] Many Thanks everyone, I resolved my question with the Ralph's support.
The variable Found (in your code) must be of type variant. So, if you explicitly set Dim Found as variant then your code should work.