Microsoft Office Tutorials and References
In Depth Information
As we can see in the following screenshot, we merged two cells and copied the
contents of the cell to cell .
A combination of ranges has to be treated as single range, and that range is referred
to as the Union . In other words, the display of a group of ranges in a combined
format is called a Union. Unions make it easy for the developer to process data
inside a worksheet. Generally, a Union is used to calculate a subtotal.
Open Visual Studio 2008 and create a new solution, as usual. Write the following
code inside the Sheet1.cs file:
private void Sheet1_Startup(object sender, System.EventArgs e)
// Creating Range object instance
Excel.Range AuthorRange1 = this.Application.get_Range("B5",
// Creating another Range object instance
Excel.Range AuthorRange2 = this.Application.get_Range("C5",
// Using Union method of current Excel
Excel.Range AuthorRange3 = this.Application.
Union(AuthorRange1, AuthorRange2, missing, missing,
Search JabSto ::

Custom Search