Reputation: 329
How can the range of a cell in excel be found through C# code?
xlWorkSheet.Cells[row + 1, col + 1]
I want to find out this cell's range.
Thanks in advance
Upvotes: 0
Views: 1933
Reputation: 60004
Excel exposes an object Range. You can access cells, for instance
rng = (Excel.Range)xlWorkSheet.Cells[row + 1, col + 1];
This statement should select a single cell. To get all the cells of the row 1 (always as Range):
rng = (Excel.Range)ws.Rows[1, Type.Missing];
Upvotes: 1