Thread: [Solved] lastincolumn function
View Single Post
 
Old 01-30-2010, 03:16 PM
BjornS BjornS is offline Windows Vista Office 2003
Competent Performer
 
Join Date: Jan 2010
Location: Sweden
Posts: 116
BjornS is on a distinguished road
Default

Hi,
I get i little puzzled when I see you function LastInRange.
Isn't your intention to get an answer of let's say 50, it the last number if 50 rows down?
Is there any special reason to why you check for numeric values only?
What is the explanation to why you have written LastInRange = "" at the end? This will always give an empty answer back.

I tried this code instead (see below). Both this and yours is fast. How long time does the function take when you use it?

Best regards
Bjorn


Function LastInRange2(InputRange As Range)
Dim CellCount As Long
Dim i As Long
CellCount = InputRange.Count
For i = CellCount To 1 Step -1
If Not IsEmpty(InputRange(i)) And IsNumeric(InputRange(i)) Then
LastInRange2 = i
Exit Function
End If
Next i
End Function
Reply With Quote