Sometimes you need to know which is the last row or column in an Excel sheet that contains actual data. To do that, use the following code:
' Find last filled column in Excel sheet
i_col = XL_PlyWorksheet.cells(1, "A").End(xlToRight).Column
' Find last filled row in Excel sheet
i_row = XL_PlyWorksheet.Range("A65536").End(xlUp).Row
Don't forget to add a reference to Excel, or you'll get a compile-time error.