NativeExcel for .Net Developer's Reference

IWorksheet.Cells Property

Returns an IRange interface that represents all the cells on the worksheet (not just the cells that are currently in use). Read-only.

[Visual Basic]
PropertyReadOnlyCellsAsIRange
[C#]
IRangeCells{get;}
[C++]
__propertyIRange*get_Cells();
[JScript]
functiongetCells():IRange

Property Value

IRange interface.

Remarks

You can also use the Range property which is synonym for the Cells property.

Example

This example sets the value of the cell B3 on sheet one.

[C#]
book.Worksheets[1].Cells[3,2].Value = 100;
[VisualBasic]
book.Worksheets(1).Cells(3,2).Value = 100
[C++]
book->Worksheets->Item[1]->Cells->Item[3,2]->Value = 100;
This example sets the value of the cell F3 on sheet one.
[C#]
book.Worksheets[1].Cells["F3"].Value = 100;
[VisualBasic]
book.Worksheets(1).Cells("F3").Value = 100
[C++]
book->Worksheets->Item[1]->Cells->Item[S"F3"]->Value = 100;
This example merges the cells B2:F4 on sheet one.
[C#]
book.Worksheets[1].Cells["B2:F4"].Merge();
[VisualBasic]
book.Worksheets(1).Cells("B2:F4").Merge()
[C++]
book->Worksheets->Item[1]->Cells->Item[S"B2:F4"]->Merge();

See Also

IWorksheet Interface | NativeExcel Namespace | IRange Interface | Range Property