Why do I get "Subscript out of range" on my line T(k) = Cells(k + 1, 4).Value - z? 
Public Sub find()
Dim i, j, k, h As Integer
Dim T() As Double
Dim z As Double
Range("E1").Activate
i = ActiveCell.Row
j = ActiveCell.Column
While Not IsEmpty(Cells(i, j - 2).Value)
  z = Cells(i, j - 2).Value
  k = 0
 While Not IsEmpty(Cells(k + 1, 4).Value)
  T(k) = Cells(k + 1, 4).Value - z
  k = k + 1
 Wend
  For h = 0 To k
   If T(h) = Application.WorksheetFunction.Min(Abs(T(k))) Then
    Cells(i, j).Value = Cells(h + 1, 4).Value
   End If
  Next
 i = i + 1
Wend
End Sub
 
     
    