Option Explicit
Sub example()
Dim rngSalary As Range
'Using the .Find method (which I happen to use a wrapper function for my preferred defaults), either
'retun a Range object if found, or Nothing if not
Set rngSalary = RangeFound(ThisWorkbook.Worksheets("Sheet1").Rows(1), "Salary", , , xlWhole, , xlNext)
'Test to see if we found it and proceed.
If Not rngSalary Is Nothing Then
MsgBox "Found at " & rngSalary.Address
Else
MsgBox "Not found"
End If
End Sub
Function RangeFound(SearchRange As Range, _
Optional ByVal FindWhat As String = "*", _
Optional StartingAfter As Range, _
Optional LookAtTextOrFormula As XlFindLookIn = xlValues, _
Optional LookAtWholeOrPart As XlLookAt = xlPart, _
Optional SearchRowCol As XlSearchOrder = xlByRows, _
Optional SearchUpDn As XlSearchDirection = xlPrevious, _
Optional bMatchCase As Boolean = False) As Range
If StartingAfter Is Nothing Then
Set StartingAfter = SearchRange.Cells(1)
End If
Set RangeFound = SearchRange.Find(What:=FindWhat, _
After:=StartingAfter, _
LookIn:=LookAtTextOrFormula, _
LookAt:=LookAtWholeOrPart, _
SearchOrder:=SearchRowCol, _
SearchDirection:=SearchUpDn, _
MatchCase:=bMatchCase)
End Function