Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to get value of last number in a column

I submitted this an hour ago, but it was never posted -- and so I apologize
if it shows up twice. I have a column(s) of portfolio values, updated daily
or weekly. I want to find the last number entered in the column so that I
can compare it to the beginning of the year portfolio value and calculate my
losses for the year. I find I can use the ROW function to find the number of
the last Row that I entered, but I can't seem to use this number in a Cell
reference:
i.e. +C=ROW(A55) to reference Cell C55 doesn't work
Is there a way to make this function work in a Cell reference, or is there
another function that would give me this information or is there a better way
to do this.
Thanks.

--
Ron Smith in Round Rock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Need to get value of last number in a column

Not sure what you mean. Range("A55") is column A, row 55. Range("C55") is
column C, row 55. These can also be written as Cells(55, 1) and Cells(55, 3)
respectively. To assign them to a variable: myVar = Cells(55, 3) would make
myVar equal "$C$55". To find the last cell in a column that contains data
you can use: ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
That code snippet will cause VBA to look from the last row on the sheet in
column 3 (or C) until it finds a cell with data. That will be the last entry
in that column, so to use it in code you assign a variable like:

lastRow = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row

Then you can identify the cell as either Range("C" & lastRow) or
Cells(lastRow, 3)

"Ron Smith" wrote:

I submitted this an hour ago, but it was never posted -- and so I apologize
if it shows up twice. I have a column(s) of portfolio values, updated daily
or weekly. I want to find the last number entered in the column so that I
can compare it to the beginning of the year portfolio value and calculate my
losses for the year. I find I can use the ROW function to find the number of
the last Row that I entered, but I can't seem to use this number in a Cell
reference:
i.e. +C=ROW(A55) to reference Cell C55 doesn't work
Is there a way to make this function work in a Cell reference, or is there
another function that would give me this information or is there a better way
to do this.
Thanks.

--
Ron Smith in Round Rock

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to get value of last number in a column

Sorry I didn't explain my problem that well. Here it is:

Line: Date Port 1 Port 2
Port 3
A B C D E F G H
I . . . . .
10
11 1/20 10 x x 20 x x 30
12 1/21 9 x x 22 x x 25
13 1/22 8 x x 24 x x 20
14 Last Line 1/23 7 x x 25 x x 15
15 (data added daily, or 5 rows at a time weekly)

20 12/31 14 15 40
21 1/23 7 25
15 <----

What I want to know is how to move the 1/23 values in Row 14, Columns B, C,
F, I, etc. down to Row 21. The rows after Row 13 are added sometimes daily,
but more often weekly at which time I add 5 rows at a time. I want to move
the values in the last line entered down to row 21, which will also move down
as I add more rows each day.

The "Last Line" is my invention. With the function ROW(A14), I can obtain
the number 14. So I wanted, for instance, to put the Cell Reference of
+C(=ROW(A14)), which would be "C14", into C21. I found that if I move the
"Last Line" text/cell in Column 1 with a "Cut" and Paste, the reference in
the ROW function will change to the last/current location of where Last Line
is pasted. So all I would have to do is move "Last Line" to the last row and
I am in business.

It all works out in my mind, but Excel doesn't see it my way. Can anyone
tell me what I am doing wrong, or how to get this to work, or give me a
simple solution on how to tackle this priblem.

Thanks.
--
Ron Smith in Round Rock


"JLGWhiz" wrote:

Not sure what you mean. Range("A55") is column A, row 55. Range("C55") is
column C, row 55. These can also be written as Cells(55, 1) and Cells(55, 3)
respectively. To assign them to a variable: myVar = Cells(55, 3) would make
myVar equal "$C$55". To find the last cell in a column that contains data
you can use: ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row
That code snippet will cause VBA to look from the last row on the sheet in
column 3 (or C) until it finds a cell with data. That will be the last entry
in that column, so to use it in code you assign a variable like:

lastRow = ActiveSheet.Cells(Rows.Count, 3).End(xlUp).Row

Then you can identify the cell as either Range("C" & lastRow) or
Cells(lastRow, 3)

"Ron Smith" wrote:

I submitted this an hour ago, but it was never posted -- and so I apologize
if it shows up twice. I have a column(s) of portfolio values, updated daily
or weekly. I want to find the last number entered in the column so that I
can compare it to the beginning of the year portfolio value and calculate my
losses for the year. I find I can use the ROW function to find the number of
the last Row that I entered, but I can't seem to use this number in a Cell
reference:
i.e. +C=ROW(A55) to reference Cell C55 doesn't work
Is there a way to make this function work in a Cell reference, or is there
another function that would give me this information or is there a better way
to do this.
Thanks.

--
Ron Smith in Round Rock

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FInd common data in one column then add number in adjacent column JT Excel Worksheet Functions 3 December 18th 09 10:20 PM
inverse of the column function? i.e. input a number, output thecorresponding column text label Brotherharry Excel Worksheet Functions 19 February 14th 09 12:37 AM
Count number of cells and total in one column, based on another column suffix Pierre Excel Worksheet Functions 5 October 31st 07 12:28 AM
Display missing Part Number if Column A does not match column B Erik T Excel Worksheet Functions 2 April 17th 06 11:23 PM
Auto number w/ different letter-number combos in same column Colleen B Excel Worksheet Functions 2 February 23rd 05 02:41 PM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"