View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Find last cell of data

Hi Ariel,

What is the (2) for in this statement.


LastRow = Cells(Rows.Count, "A").End(xlUp)(2).Row


This line of code is an abbreviation for:

LastRow = Cells(Rows.Count, "A").End(xlUp).Item(2,1).Row

and is equivalent to:

LastRow = Cells(Rows.Count, "A").End(xlUp).Offset(1,0).Row

For a detailed discussion of this, Chip Pearson hosts an excellent article,
written by Alan Beban

http://www.cpearson.com/excel/cells.htm


---
Regards,
Norman