IRONSOFTWAREHOME
Combine Multiple Excel Ranges in C#
using IronXL;
using System;
using System.Linq;

WorkBook workBook = WorkBook.Load("sample.xls");
WorkSheet workSheet = workBook.WorkSheets.First();

// Get a range from an Excel worksheet
var range = workSheet["A2:A8"];

// Combine two ranges
var combinedRange = range + workSheet["A9:A10"];

// Iterate over combined range
foreach (var cell in combinedRange)
{
    Console.WriteLine(cell.Value);
}
Imports IronXL
Imports System
Imports System.Linq

Dim workBook As WorkBook = WorkBook.Load("sample.xls")
Dim workSheet As WorkSheet = workBook.WorkSheets.First()

' Get a range from an Excel worksheet
Dim range = workSheet("A2:A8")

' Combine two ranges
Dim combinedRange = range + workSheet("A9:A10")

' Iterate over combined range
For Each cell In combinedRange
    Console.WriteLine(cell.Value)
Next
NuGet Download
PM > Install-Package IronXL.Excel
Combine Multiple Excel Ranges in C#

Combine Multiple Excel Ranges in C#

IronXL is a C# library that allows for efficient manipulation of Excel files. One of its features is the ability to combine IronXL.Range objects using the + operator.

Using the + operator to combine IronXL.Range objects is a versatile way to handle multiple ranges as a single entity. This can be incredibly useful in scenarios requiring the aggregation of data from various sections of a worksheet.

Explore How to Write to Excel with IronXL
View on GitHub

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required