Thread
:
Next to last non-empty cell in row
View Single Post
#
6
Posted to microsoft.public.excel.misc
Cong Nguyen
external usenet poster
Posts: 20
Next to last non-empty cell in row
Hi Gary"s Student,
Sorry about the not-clear question.
I want a cell in another tab shows the content of the next to last non-empty
cell of a row from a different tab, i.e., $J$9
Thank you.
--
Cong Nguyen
"Gary''s Student" wrote:
Lets say the last filled cell in row #9 is K9
and that J9 contains 5. Then
=WhereIsIt(9) will display $J$9 - the location
of the next to the last filled cell in row 9
=WhatsInIt(9) will display 5, the content of that cell.
Here is the code:
Function WhereIsIt(n As Long) As String
m = Cells(n, Columns.Count).End(xlToLeft).Column
WhereIsIt = Cells(n, m - 1).Address
End Function
Function WhatsInIt(n As Long) As Variant
m = Cells(n, Columns.Count).End(xlToLeft).Column
WhatsInIt = Cells(n, m - 1).Value
End Function
--
Gary''s Student - gsnu200749
"Cong Nguyen" wrote:
Is there a way to select the next to last non-empty cell in a row?
Thank you.
--
Cong Nguyen
Reply With Quote
Cong Nguyen
View Public Profile
Find all posts by Cong Nguyen