Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

HOW TO FIND LAST CELL VALUE IN PARTICULAR COLUMN AND ROW IN EXCEL

  Asked By: Boell    Date: Feb 27    Category: MS Office    Views: 7190
  

i am new to using macro ,i need help from you all,
pls tell how to get last cell value in particular column or row using
vba macro

for example if sheet1 column A, cell no-21 is the last cell ,and
value may be numbers or text then , i need to get the that value
through msgbox.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Nicolas Costa     Answered On: Feb 27

Sub LastRow()
'By going to the last row  in excel  and then moving up (like Control-UpArrow in
Excel), you will find  the data you are looking for
YourValue = Range("A65536").End(xlUp).Value
Message = MsgBox("The data in the last row is: " & YourValue)
End Sub

 
Answer #2    Answered By: Djoser Massri     Answered On: Feb 27

With the new Excel 2007 coming out with its 1 million rows, it is best
not to identify a starting cell  range in the search. It is better to use
the following line of code when searching a column  for the last cell.



Value = Cells(Rows.Count, "A").End(xlup).Row



Change "A" to whatever column you are using.

 
Answer #3    Answered By: Sherrie Thomas     Answered On: Feb 27

I Hope this is what you were looking for

ActiveSheet.Columns("A").SpecialCells(xlLastCell).Select
MsgBox ActiveCell.Value

 




Tagged: