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: Bing    Date: Sep 09    Category: MS Office    Views: 17063
  

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: 

 

4 Answers Found

 
Answer #1    Answered By: Marina Smith     Answered On: Sep 09

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: Verner Fischer     Answered On: Sep 09

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: Luz Hayes     Answered On: Sep 09

I Hope this is what you were looking for

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

 
Answer #4    Answered By: Vidos Fischer     Answered On: Sep 09

thank you, this is i expect................

 




Tagged: