Hi all,
I've been using this function to find the last value in column. Now I would need it modified to find second to last instead. How do I change it?
I've been using this function to find the last value in column. Now I would need it modified to find second to last instead. How do I change it?
Code:
Function LASTINCOLUMN(rng As Range)
Dim LastCell As Range
Application.Volatile
With rng.Parent
With .Cells(.Rows.Count, rng.Column)
If Not IsEmpty(.Value) Then
LASTINCOLUMN = .Value
ElseIf IsEmpty(.End(xlUp)) Then
LASTINCOLUMN = " "
Else
LASTINCOLUMN = .End(xlUp).Value
End If
End With
End With
End Function