Experimente:
Sub hjksdf()
Dim lastRow As Long
With ActiveSheet
lastRow = .Range("B" & .Rows.Count).End(xlUp).Row
End With
For i = lastRow To 1 Step -1
If Cells(i, "B").Text <> "#N/A" Then
Exit For
End If
Next i
lastRow = i
MsgBox i
End Sub
EDIT # 1:
Aqui estão algumas formas de encontrar o último Z e o primeiro Z :
Sub FindLastZ()
Dim lastRow As Long
With ActiveSheet
lastRow = .Range("B" & .Rows.Count).End(xlUp).Row
End With
For i = lastRow To 1 Step -1
If Cells(i, "B").Text = "Z" Then
Exit For
End If
Next i
lastRow = i
MsgBox i
End Sub
Sub FindFirstZ()
Dim lastRow As Long
With ActiveSheet
lastRow = .Range("B" & .Rows.Count).End(xlUp).Row
End With
For i = 1 To lastRow
If Cells(i, "B").Text = "Z" Then
Exit For
End If
Next i
lastRow = i
MsgBox i
End Sub