I can think of two approaches. The first option is to use a named range, not a cell position. In this case, you can, for example, name A1: A10 “MyList” and read the contents in the array using
Excel.Range range = worksheet.get_Range("MyList", Type.Missing);
object[,] data = (object[,])range.Value2;
, (, ), .
, , . , , (, 100 ), . , - , startRow , :
int startRow = 1;
bool hasContent = false;
int row = startRow;
do
{
var cell = (Excel.Range)sheet.Cells[row,1];
if (cell.Value2 != null)
{
hasContent = true;
row++;
}
}
while (hasContent);