IRONSOFTWAREHOME

Get Started with Code Samples

C# VB PDF .NET : Work with Excel WorkSheets in VB .NETWork with Excel WorkSheets in VB .NET
using IronXL;

// Create new Excel spreadsheet
WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLSX);

// Create worksheets (workSheet1, workSheet2, workSheet3)
WorkSheet workSheet1 = workBook.CreateWorkSheet("workSheet1");
WorkSheet workSheet2 = workBook.CreateWorkSheet("workSheet2");
WorkSheet workSheet3 = workBook.CreateWorkSheet("workSheet3");

// Set worksheet position (workSheet2, workSheet1, workSheet3)
workBook.SetSheetPosition("workSheet2", 0);

// Set active for workSheet3
workBook.SetActiveTab(2);

// Remove workSheet1
workBook.RemoveWorkSheet(1);

workBook.SaveAs("manageWorkSheet.xlsx");
NuGet Downloads Badge
PM > Install-Package IronXL.Excel

IronXL library makes managing worksheets using C# code as easy as possible. The actions of creating & deleting worksheets, changing worksheet positions, and setting the active worksheet in an Excel file can be achieved without using Office Interop.

Create Worksheet

The CreateWorkSheet method allows creating a worksheet. It requires the worksheet name as the only parameter.

  • This code snippet creates a new workbook and a new worksheet named "NewSheet" within that workbook.

Set Worksheet Position

The SetSheetPosition method can be used to change or move a worksheet's position. Two parameters are required: the worksheet name as a string and its index position as an integer.

  • This modifies the position of the worksheet named "SheetName" to the second position in the workbook (remember, indexing is zero-based).

Set Active Worksheet

Setting the active worksheet means setting which worksheet will be opened by default when the workbook is accessed. To achieve this, use the SetActiveTab method with the index position of the worksheet.

  • This sets the first worksheet as the active tab that opens by default.

Remove Worksheet

Removing a worksheet can also be done with IronXL. Use the RemoveWorkSheet method along with the index position of the worksheet. If the worksheet's position is unknown, the name of the worksheet can also be used to delete it.

  • The first example removes the first worksheet in the workbook by index.
  • The second example removes the worksheet named "SheetName".

Please note that all the index positions mentioned above utilize zero-based indexing, meaning the first element has an index of 0.

Direct Support from Our VB .NET Development Team

The Iron Visual Basic .NET product development team is available to support your questions. Get in touch to make the most of our library in your project.

Work with Excel Files in VB.NET

Quick way to work with Excel Worksheets in Visual Basic VB.NET. Works in VB .NET Core and Azure with no special dependencies and no need to install MS Office or Interop.

Read & Write Excel Files in VB.NET

IronXL allows you to read Excel data from Spreadsheets in your .NET APPs. Read & Edit XLS/XLSX/CSV/TSV - Save & Export to XLS/XLSX/CSV/TSV/JSON.

Native SQL Support

Move Data between Excel, SQL and GridViews by accessing worksheets as System.Data.DataSet and System.Data.DataTable objects.

Update Excel Data in Visual Basic .NET

Works with Microsoft Excel formulas - recalculate if a worksheet it updated. Easy to use WorkSheet [“A1:B10”] syntax. Sort by Ranges, Columns and Rows.

Style Excel Sheet Cells with VB

Set Font, Size, Background, Border, Alignment and Number format.
Visual Studio - VB Create Excel Spreadsheet .NET Library - for Excel document Creation and Editing.

Install into Microsoft Visual Studio

IronXL gives you Excel generation and editing tools. Install directly from NuGet or download the DLL.

Supports:

  • .NET Core 2.0 and above
  • .NET Framework 4.0 and above support C#, VB, F#
  • Microsoft Visual Studio. .NET Development IDE Icon
  • NuGet Installer Support for Visual Studio
  • JetBrains ReSharper C# language assistant compatible
  • Microsoft Azure C# .NET  hosting platform compatible

Licensing & Pricing

Free community development licenses. Licenses from $999.

View Full License Options

Excel Spreadsheet Tutorials for VB .NET

How to Create Excel Files in VB
VBExcelASP.NET
Jonas Schmidt - C# Developer

How to Create Excel Files in .NET

See How Jonas uses IronXL to generate Excel Files without using Office Interop...

View Jonas' Excel File Generation Tutorial
Reading and Writing Excel Tutorial + Code Examples in C# & VB.NET
C#ExcelXLS
Elijah Williams - Product Development Engineer

Open and Edit Excel Files in VB.NET

Elijah shares a no-nonsense approach to reading Excel data into C# Applications...

See Elijah's Excel Reading & Editing Tutorial
Tutorial + Code Examples VB.NET PDF Creation and Editing | VB.NET & ASP.NET PDF
C#ExcelData
Rebecca White - .NET Solution Director

How to Read Excel Files into .NET Apps.

Rebecca's code walkthrough for reading Excel data into a .NET application...

Read Becky's C# Tutorial

Professional developers use IronXL for...

Accounting and Finance Systems

  • # Receipts
  • # Reporting
  • # Invoice Printing
Add Excel Support to ASP.NET Accounting and Finance Systems

Business Digitization

  • # Documentation
  • # Ordering & Labelling
  • # Paper Replacement
C# Business Digitization Use Cases

Enterprise Content Management

  • # Content Production
  • # Document Management
  • # Content Distribution
.NET CMS Excel Support

Data and Reporting Applications

  • # Performance Tracking
  • # Trend Mapping
  • # Reports
C# Excel Reports
Join Them Today
Iron Software Enterprise .NET Component Developers
C# Library Developers

Thousands of corporations, governments, SMEs and developers alike trust Iron software products.

Iron's team have over 10 years experience in the .NET software component market.

Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon

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