Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need value of last number in a column
I have a column of numbers (stock prices) that I am updating daily. I want
to use the last value I entered in the column to calculate my losses (current price - fixed beginning stock price). I can get the Row number with the ROW function, but am unsuccessful when trying to use this number in a Cell reference: i.e. +C=ROW(A55) -- where C is the column and =ROW(A55) will return 55 (contents of Cell 55 being what I am after). Is there a way I can get this Cell reference to work or is there another function or method I can use to determine the last value in a column. -- Ron Smith in Round Rock |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need value of last number in a column
Give this snippet a go...
Assign it to a variable: myCellValue = Cells(Rows.Count, 3).End(xlUp).Value Then you can utilize "myCellValue" somewhere else in your code. If you are looking for a user defined function, take a look at the following from http://www.mvps.org/dmcritchie/excel/lastcell.htm ' Apply this function to a new module in your workbook Function LastInColumn(rng As Range) As Variant LastInColumn = Cells(Rows.Count, rng(1).Column).End(xlUp).Value End Function Then you can reference it on your worksheet with the following function call: =LastInColumn(C:C) "Ron Smith" wrote in message ... I have a column of numbers (stock prices) that I am updating daily. I want to use the last value I entered in the column to calculate my losses (current price - fixed beginning stock price). I can get the Row number with the ROW function, but am unsuccessful when trying to use this number in a Cell reference: i.e. +C=ROW(A55) -- where C is the column and =ROW(A55) will return 55 (contents of Cell 55 being what I am after). Is there a way I can get this Cell reference to work or is there another function or method I can use to determine the last value in a column. -- Ron Smith in Round Rock |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
inverse of the column function? i.e. input a number, output thecorresponding column text label | Excel Worksheet Functions | |||
How do I turn excel columns from column number to column letter? | Setting up and Configuration of Excel | |||
Count number of cells and total in one column, based on another column suffix | Excel Worksheet Functions | |||
Display missing Part Number if Column A does not match column B | Excel Worksheet Functions | |||
Auto number w/ different letter-number combos in same column | Excel Worksheet Functions |