ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find last non empty cell in a column and display value in msgb (https://www.excelbanter.com/excel-programming/423233-re-find-last-non-empty-cell-column-display-value-msgb.html)

vbnewbie

find last non empty cell in a column and display value in msgb
 
See previous post!

"Gary''s Student" wrote:

and if you don't want to see the formula result, try:

Sub lvalue()
Dim n As Long, i As Long
n = Cells(Rows.Count, 2).End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, 2).HasFormula Then
Else
MsgBox (Cells(i, 2).Value)
Exit Sub
End If
Next
End Sub

--
Gary''s Student - gsnu200830


"vbnewbie" wrote:

I have a column of numbers and wish to display the last non empty cell value
in the column in a msgbox. In rows where there are no values entered the
cells in this column have formulae until updated manually.
e.g.
Row Column A Column B
1 28/01/19 2106
2 30/01/09 2107 < value I wish to display in msgbox
3 =SUM(B2+1 )

I wish to add the value using a macro

Thanks in advance



All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com