Forum Discussion
Excel help!
Thanks for all the suggestions! Something I failed to tell is that when this mortgage table calculates the new value for number of payments the column will also shorten to this new value, and the remaining values will not be visible in the column. I need it to find the last visible data or value in this column.
Thanks!
- HansVogelaarSep 09, 2025MVP
Do you mean that some rows are hidden?
Or do you use formatting to make some values invisible?
- jsrmenkeSep 09, 2025Copper Contributor
Yes, the rows that are no longer used because of a shorter payment schedule become invisible. I want to locate that last visible cell.
- HansVogelaarSep 09, 2025MVP
I think you need VBA for that, so it will work only in the desktop version of Excel for Windows and Mac.
Press Alt+F11 to activate the Visual Basic Editor.
Select Insert > Module.
Copy the following code into the new module:
Function LastValue(r As Range) As Variant Dim w As Worksheet Set w = r.Parent LastValue = w.Cells(w.Rows.Count, r.Column).End(xlUp).Value End Function
Switch back to Excel.
The last visible value in column K is returned by the formula
=LastValue(K:K)
Save the workbook as a macro-enabled workbook (*.xlsm), and make sure that you allow macros when you open it.