Partager via


Working with Worksheets

The Worksheet and Worksheet classes contain the methods and properties you use to perform tasks with worksheets.

Task

Procedure

Add a new worksheet to a workbook.

How to: Programmatically Add New Worksheets to Workbooks

Make a copy of a worksheet in a specified location in the workbook.

How to: Programmatically Copy Worksheets

Delete a specified worksheet.

How to: Programmatically Delete Worksheets from Workbooks

Move the user's selection to a specified worksheet.

How to: Programmatically Select Worksheets

Iterate through the collection of all worksheets.

How to: Programmatically List All Worksheets in a Workbook

Preview and print a worksheet.

How to: Programmatically Print Worksheets

Move a worksheet to a new location in a workbook.

How to: Programmatically Move Worksheets Within Workbooks

Change the visibility of one or more worksheets.

How to: Programmatically Hide Worksheets

Lock all or part of a worksheet so it cannot be edited.

How to: Programmatically Protect Worksheets

Remove the lock from a worksheet so it can be edited.

How to: Programmatically Remove Protection from Worksheets

Add and delete comments.

How to: Programmatically Add and Delete Worksheet Comments

Show or hide all comments.

How to: Programmatically Display Worksheet Comments

Create groups in worksheets.

How to: Programmatically Group Rows in a Worksheet

Make a row bold only when it contains a selected cell.

How to: Programmatically Change Formatting in Worksheet Rows Containing Selected Cells

Copy data and formatting across worksheets.

How to: Programmatically Copy Data and Formatting across Worksheets

Check spelling in worksheets.

How to: Programmatically Check Spelling in Worksheets

Sort data in named ranges and list objects.

How to: Programmatically Sort Data in Worksheets

For more information about Excel tasks and the Excel object model, see Excel Object Model Overview.

In some cases, the ways that you perform these tasks in application-level add-ins is different from the ways that you perform them in document-level customizations.

See Also

Concepts

Automating Excel by Using Extended Objects

Working with Workbooks

Working with Ranges

Using Windows Forms Controls on Excel Worksheets