The problem is that the code to set the range is never executed.
Try this.
Option Explicit
Sub Tst_EX()
Dim TempName As Range
Dim rngFnd As Range
With Worksheets("TMA")
Set rngFnd = .Cells.Find(What:="TEMP", After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False)
If Not rngFnd Is Nothing Then
If rngFnd.Offset(0, 2).Value <> "" Then
Set TempName = .Range(rngFnd.Offset(0, 2), rngFnd.Offset(0, 2).End(xlDown).End(xlToRight))
End If
TempName.Name = "TEMP"
End If
End With
End Sub
Bookmarks