Excel常用对象(Excel Ojbects)

万物皆对象,Excel也不例外。平时对Excel的各种操作,其实都是针对某个对象的操作。

那么,Excel中到底有多少个对象呢?很多,多的没有人愿意去统计。

退一步而言,有多少个常用对象呢?如下所示。

Object Type

Description

Application

The current Excel Application.

Columns

The Columns object is a collection of all the Columns of a Worksheet.
A Range object consisting of an individual Worksheet column can be accessed by using an index number (i.e. Columns(1))

Range

The Range object represents any number of contiguous cells on a Worksheet. This can be just one cell or it can be all the cells on the Worksheet. A range consisting of just one cell can be returned from a Worksheet, using the Cells property (i.e. Worksheet.Cells(1,1)).
Alternatively, a range can be referenced by specifying either a cell range or a start and end cell (e.g. Worksheet.Range("A1:B10") OR Worksheet.Range("A1", "B10") OR Worksheet.Range(Cells(1,1), Cells(10,2))). Note that if the second cell reference is omitted from the Range (e.g. Worksheet.Range("A1") OR Worksheet.Range(Cells(1,1)), this will return a range that consists of only one cell.

Rows

The Rows object is a collection of all the Rows of a Worksheet.
A Range object consisting of an individual Worksheet row can be accessed by using an index number (i.e. Rows(1))

Sheets

The Sheets object is a collection of all the Sheets in a Workbook. These Sheets can be Worksheets or Charts.
An individual Sheet can be extracted from the Sheets object by using an individual Sheet index number or name (i.e. Sheets(1) or Sheets("Sheet1")).

Workbook

A Workbook object can be accessed from the Workbooks Collection by using a Workbook index number or a Workbook name (e.g. Workbooks(1) or Workbooks("Book1")). You can also use 'ActiveWorkbook' to access the current active Workbook.
From the Workbook object, you can access the Sheets object, which is a collection of all the Sheets (Worksheets and Chart Sheets) in the Workbook, and you can also access the Worksheets object, which is a collection of all the Worksheets in the Workbook.

Workbooks

The Workbooks object is a collection of all of the open Excel Workbooks in the current Excel Application.
An individual Workbook can be extracted from the Workbooks object by using an individual Workbook index number or name (i.e. Workbooks(1) or Workbooks("Book1")).

Worksheet

A Worksheet object can be accessed from the Sheets or the Worksheets object by using a Sheet or Worksheet index number or a Sheet or Worksheet name (e.g. Sheets(1), Worksheets(1), Sheets("Sheet1") or Worksheets("Wksheet1")). You can also use 'ActiveSheet' to access the current active Sheet.
From the Worksheet object, you can access the Rows and Columns objects, which are collections of Range objects relating to the Rows and Columns of the Worksheet. You can also access an individual cell or any Range of contiguous cells on the Worksheet.

Worksheets

The WorkSheets object is a collection of all the WorkSheets in a Workbook (i.e. all the Sheets, except the Charts). An individual Worksheet can be extracted from the Worksheets object by using an individual Worksheet index number or name (i.e. Worksheets(1) or Worksheets("Wksheet1")).

 


猜你喜欢

转载自blog.csdn.net/hpdlzu80100/article/details/80655678