Microsoft Office 2000/Visual Basic Programmer's Guide   

Understanding the Worksheet Object

Most of the work you will do in Excel will be within the context of a worksheet. A worksheet contains a grid of cells you can use to work with data and hundreds of properties, methods, and events you can use to work with the data in a worksheet.

To work with the data contained in a worksheet, in a cell or within a range of cells, you use a Range object. The Worksheet and Range objects are the two most basic and most important components of any custom solution you create within Excel. For more information about the Range object, see "Understanding the Range Object" later in this chapter.

The Workbook object's Worksheets property returns a collection of all the worksheets in the workbook. The Workbook object's Sheets property returns a collection of all the worksheets and chart sheets in the workbook.

Each Excel workbook contains one or more Worksheet objects and can contain one or more chart sheets as well. Charts in Excel are either embedded in a worksheet or contained on a chart sheet. You can have only one chart on a chart sheet, but you can have multiple charts on a worksheet. Each embedded chart on a worksheet is a member of the Worksheet object's ChartObjects collection. Worksheet objects are contained in the Worksheets collection, which you can access by using the Workbook object's Worksheets property. When you use VBA to create a new workbook, you can specify how many worksheets it will contain by using the Application object's SheetsInNewWorkbook property.