Name

workbook.Worksheets

Synopsis

Returns a collection containing all the worksheets in a workbook. Use the Worksheets collection to get a specific worksheet from a workbook. For example, the following code gets a reference to the General worksheet and assigns it to an object variable:

Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("General")

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.