NativeExcel2 for .Net Developer's Reference

IRange.MergeArea Property

Returns an IRange interface that represents the merged range containing the specified cell. If the specified cell isn't in a merged range, this property returns the specified cell.

[Visual Basic]
PropertyReadOnlyMergeAreaAsIRange
[C#]
IRangeMergeArea{get;}
[C++]
__propertyIRange*get_MergeArea();
[JScript]
functiongetMergeArea():IRange

Property Value

IRange interface.

Example

This example sets the value of the merged range that contains cell A3.

[C#]
 IRange r = book.Worksheets[1].Range["A3"].MergeArea; 
 r[1,1].Value = String.Format("{0}x{1}", r.Rows.Count, r.Columns.Count);
[VisualBasic]
 Dim r As IRange = book.Worksheets(1).Range("A3").MergeArea
 r(1,1).Value = String.Format("{0}x{1}", r.Rows.Count, r.Columns.Count)
[C++]
 IRange* r = book->Worksheets->Item[1]->Range->Item[S"A3"]->MergeArea; 
 r->Item[1,1]->Value = String::Format(S"{0}x{1}", r->Rows->Count, r->Columns->Count);

See Also

IRange Interface | NativeExcel Namespace | MergeCells Property