Excel - Finding the Last Row, Column or Cell
By Sergey - Posted on January 1st, 2008
Tagged:
| This is sample code. Add error handling and adjust to your requirements as necessary. |
#DEFINE xlA1 1 #DEFINE xlR1C1 -4150 #DEFINE xlLastCell 11 && Last Row/Column lnLastRow = oSheet.UsedRange.Rows.Count lnLastCol = oSheet.UsedRange.Columns.Count && Last Cell - Intersection of the last row and the last column lcLastCell = oSheet.Cells.SpecialCells(xlLastCell).Address(,,xlR1C1)
Thanks for posting useful tips.