NativeExcel2 for .NET Developer's Reference

Referring to Ranges by using Index numbers

You can use the Range or Cells property to refer to a range of cells by using row and column index numbers.


The following example changes the format of cells A1:D5 to bold.

//variant 1
book.Worksheets[1].Cells[1,1,5,4].Font.Bold = true;
//variant 2
book.Worksheets[1].Range[1,1,5,4].Font.Bold = true;
[Visual Basic]
'variant 1
book.Worksheets(1).Cells(1,1,5,4).Font.Bold = True
'variant 2
book.Worksheets(1).Range(1,1,5,4).Font.Bold = True
//variant 1
book->Worksheets->Item[1]->Cells->Item[1,1,5,4]->Font->Bold = true;
//variant 2
book->Worksheets->Item[1]->Range->Item[1,1,5,4]->Font->Bold = true;

See also

IRange.Item[int, int, int, int] Property