Function Latest(Columnheading As String, headingrow As Integer, startcell As Range)
Dim CH As String
Dim CHR As Integer
Dim DIR As Integer
Dim N As Integer
Dim X As Variant
CH = Columnheading
X = Range(startcell)
Range(X).Select
Range(X).Activate
N = Range(X).Row - headingrow
I = Range(X).Column
c = 0
Do Until c = I
If ActiveCell.Offset(-N, -c).Value = CH Then
If ActiveCell.Offset(N, -c).Value <> 0 Then
Latest = ActiveCell.Offset(N, -c).Value
End
Else
End If
Else
c = c + 1
End If
Loop
End Function
|