The first problem is that searchTerm is defined as a Range object. You must set the destination of the objects using the Set keyword. Thus, the assignment becomes Set searchTerm = Range("A1:A999")...
Secondly, you will get error messages if searchTerm not found, because searchTerm will be set to Nothing . We can avoid this problem by using a simple condition to check if a job found.
Therefore, your updated Sub might look something like this:
Private Sub CmdBtnClockIt_Click() Dim job As String Dim searchTerm As Range job = CmbBoxJob.Value Set searchTerm = Range("A1:A999").Find(what:=job, searchorder:=xlByColumns, searchdirection:=xlPrevious) If searchTerm Is Nothing Then MsgBox "Text was not found" Else MsgBox "Last cell is " & searchTerm.Address End If End Sub
source share