I am trying to get the last Row in Column A
.
Does anyone know why the following does not compile?
It seem that it doesn't like .End
…
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
xlWorkSheet =
(Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
int iLastRow = xlWorkSheet.Cells[1,"A"]
.End(Microsoft.Office.Interop.Excel.XlDirection.xlUp)
.Row;
It compiles for me, your method always returns 1, I did this and it worked:
To find the last used row I think this method is better: