GeertVerhoeven
Technical User
Hi all,
I'm having a problem with selecting the last filled cell from an excel worksheet. I've looked on the internet and found xlCellTypeLastCell. Unfortunately it doesn't work for me. I have a sheet with 10 items but it always selects only the first cell and not all the cells.
Does anyone have an idea (code is in C#).
Code I'm using:
Excel.Worksheet sheetSource = (Excel.Worksheet)workbook.Sheets[1];
Excel.Range range = sheetSource.get_Range("A1", sheetSource.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing));
int numberOfElements = range.Count; // Always 1 !!!!
Thanks in advance !
Geert
I'm having a problem with selecting the last filled cell from an excel worksheet. I've looked on the internet and found xlCellTypeLastCell. Unfortunately it doesn't work for me. I have a sheet with 10 items but it always selects only the first cell and not all the cells.
Does anyone have an idea (code is in C#).
Code I'm using:
Excel.Worksheet sheetSource = (Excel.Worksheet)workbook.Sheets[1];
Excel.Range range = sheetSource.get_Range("A1", sheetSource.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing));
int numberOfElements = range.Count; // Always 1 !!!!
Thanks in advance !
Geert