Array Formulas and Last Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an array formula that extends 1500 rows. The formula in the cells
return data from another source. I need to graph this data, but the graph
(as expected) plots all the cells with no actual value.

How do I detect what row the last real value is contained in?
 
=MAX(ROW(A1:A1500)*(A1:A1500<>""))

entered as an array formula with <Ctrl> <Shift> <Enter>.
 
Simplified version:

Function LastRow() As Long
Dim i As Long
For i = 1500 to 1 Step -1
If Range(i, 1) <> "" Then
LastRow = i
Exit For
End If
Next
End Function
 
That works great, thankyou for your brain.

Vasant Nanavati said:
Simplified version:

Function LastRow() As Long
Dim i As Long
For i = 1500 to 1 Step -1
If Range(i, 1) <> "" Then
LastRow = i
Exit For
End If
Next
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top