Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() I'm in need of a function that will select the second-to-last used sell in a specified row or column. I have a function that selects the LAST cell...(I've included the code below)but now I need another function that selects the SECOND-TO-LAST cell can some code be inserted into this to make that happen?....thanks in advance. Function Last_Cell_value(Col_or_Row_Range As Range) ' ' Last_Cell_value Macro ' Returns the value in the last occupied cell of a _ single column or row range. *Range cannot include _ row 65536 or column IV.* ' ' ' =Last_Cell_value($A$5:$Z$5) for ROW ' =Last_Cell_value($A$1:$A$500) for COLUMN ' ' ' If Col_or_Row_Range.Columns.Count = 1 Then If Col_or_Row_Range.Cells _ (Col_or_Row_Range.Rows.Count, 1) < "" Then Last_Cell_value = _ Col_or_Row_Range.Cells(Col_or_Row_Range.Rows.Count , 1) Else Last_Cell_value = _ Col_or_Row_Range.Cells _ (Col_or_Row_Range.Rows.Count + 1, 1).End(xlUp) End If Else If Col_or_Row_Range.Cells _ (1, Col_or_Row_Range.Columns.Count) < "" Then Last_Cell_value = _ Col_or_Row_Range.Cells(1, Col_or_Row_Range.Columns.Count) Else Last_Cell_value = _ Col_or_Row_Range.Cells _ (1, Col_or_Row_Range.Columns.Count).End(xlToLeft) End If End If End Function -- sandr5 ------------------------------------------------------------------------ sandr5's Profile: http://www.excelforum.com/member.php...o&userid=32675 View this thread: http://www.excelforum.com/showthread...hreadid=524803 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Function that Returns address of that cell? | Excel Worksheet Functions | |||
I NEED HELP with the SPELLNUMBER Function | Excel Worksheet Functions | |||
Possible Lookup Table | Excel Worksheet Functions | |||
Hyperlinks using R[1]C[1] and offset function in its cell referenc | Excel Worksheet Functions | |||
GET.CELL | Excel Worksheet Functions |