IronXL How-Tos Select Range How to Select Range Chaknith Bin Updated:July 28, 2025 IronXL provides a convenient way to select and manipulate ranges within an Excel Worksheet without using Office Interop. How to Select Range in Excel Download the C# library to select range Use workSheet ["A2:B8"] directly after the WorkSheet object to select a range of cells Utilize the GetRow method to select a row of a worksheet Select a column of the given worksheet with the GetColumn method Combine ranges easily with the '+' operator Get started with IronXL Start using IronXL in your project today with a free trial. First Step: Start for Free Select Range Example With IronXL, you can perform various operations on selected ranges, such as sorting, calculations, and aggregations. Please noteWhen applying methods that modify or move cell values, the affected range, row, or column will update its values accordingly. TipsIronXL allows us to combine more than one IronXL.Ranges.Range using the '+' operator. Select Range To select a range from cell A2 to B8, you can use the following code: :path=/static-assets/excel/content-code-examples/how-to/select-range-range.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get range from worksheet var range = workSheet["A2:B8"]; Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get range from worksheet Private range = workSheet("A2:B8") $vbLabelText $csharpLabel Select Row To select the 4th row, you can use the GetRow(3) method with zero-based indexing. This will include all cells in the 4th row, even if some corresponding cells in other rows are empty. :path=/static-assets/excel/content-code-examples/how-to/select-range-row.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get row from worksheet var row = workSheet.GetRow(3); Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get row from worksheet Private row = workSheet.GetRow(3) $vbLabelText $csharpLabel Select Column To select column C, you can use the GetColumn(2) method or specify the range address as workSheet ["C:C"]. Like the GetRow method, it will include all relevant cells, whether they are filled in the specified column or not. :path=/static-assets/excel/content-code-examples/how-to/select-range-column.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get column from worksheet var column = workSheet.GetColumn(2); Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get column from worksheet Private column = workSheet.GetColumn(2) $vbLabelText $csharpLabel TipsAll the row and column index positions adhere to zero-based indexing. Combine Ranges IronXL provides the flexibility to combine multiple IronXL.Ranges.Range objects using the '+' operator. By using the '+' operator, you can easily concatenate or merge ranges together to create a new range. Please noteCombining rows and columns directly using the '+' operator is not supported. Combining ranges will modify the original range. In the code snippet below, the variable range will be modified to include the combined ranges. :path=/static-assets/excel/content-code-examples/how-to/select-range-combine-range.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xls"); WorkSheet workSheet = workBook.WorkSheets.First(); // Get range from worksheet var range = workSheet["A2:B2"]; // Combine two ranges var combinedRange = range + workSheet["A5:B5"]; Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xls") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Get range from worksheet Private range = workSheet("A2:B2") ' Combine two ranges Private combinedRange = range + workSheet("A5:B5") $vbLabelText $csharpLabel Frequently Asked Questions How do I select a range of cells in Excel using IronXL? You can select a range of cells in Excel using IronXL by directly referencing the range with workSheet["A2:B8"] after obtaining a WorkSheet object. What is the method to select an entire row in IronXL? You can select an entire row in IronXL using the GetRow method with zero-based indexing. For example, to select the 4th row, use worksheet.GetRow(3). How can I select a column in an Excel worksheet using IronXL? To select a column in IronXL, use the GetColumn method with zero-based indexing, such as worksheet.GetColumn(2) for column C, or specify the range as worksheet["C:C"]. Is it possible to combine multiple ranges in IronXL? Yes, you can combine multiple IronXL.Ranges.Range objects using the '+' operator to merge two or more ranges into a new range. Does IronXL require Office Interop to select and manipulate Excel ranges? No, IronXL allows selecting and manipulating Excel ranges without the need for Office Interop, making it a simpler and more efficient option for working with Excel files. What operations can I perform on a selected range in IronXL? Once a range is selected in IronXL, you can perform operations like sorting, calculations, and aggregations. Any modifications to cell values within these ranges will dynamically update the spreadsheet. How does combining ranges affect the original range in IronXL? Combining ranges with the '+' operator in IronXL modifies the original range to include the combined ranges, allowing for seamless manipulation of larger datasets. What indexing system does IronXL use for rows and columns? IronXL uses zero-based indexing for both rows and columns, meaning the index starts at 0. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Ready to Get Started? Free NuGet Download Total downloads: 1,558,208 View Licenses