Thread: Counting Code
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Robert McCurdy Robert McCurdy is offline
external usenet poster
 
Posts: 102
Default Counting Code

Try this Todd. Entered normally.

=INDEX(A:A,SUMPRODUCT(MAX(ROW(A7:A2100)*(A7:A2100< ""))))

In code it looks like this..

Sub LastValue()
Dim x As Variant
x = Evaluate("=Index(A:A,Sumproduct(Max(Row(A7:A2100)* (A7:A2100<""""))))")
MsgBox x
End Sub


Regards Robert

"Todd Huttenstine" wrote in message ...
Hey guys I have a list of values in range Column A:A.
There is a value in cell A7, then the next value in the
range is in cell A10, then A13. As you can see there is
value in every 3 cells. There maybe 700 values but they
span in a range from approximately A7:A2100.

I usually use the count or counta function in my loop
codes to specify the end of the range, but in this case
the count function will not work because there are many
blank cells in the range.

How do I look for the last value in column A:A and return
that cell number? For instance, the last value in Column
A:A is 1929. I need the code to return 1929.


Thank you
Todd Huttenstine



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004