Đối tượng hay tập hợp?

Liên hệ QC

PhanTuHuong

VBA & VB.NET for Excel & AutoCad
Thành viên danh dự
Tham gia
13/6/06
Bài viết
7,146
Được thích
24,497
Khi làm việc với khối ô, bạn thường phải sử dụng Range(...). Một số sách gọi đó là đối tượng (object), một số gọi là tập hợp(collection) trong đó có Help của MVB.
Như vậy, trường hợp và điều kiện nào là đúng?

Xin ý kiến các chuyên gia.
 
Hướng ơi, anh nghĩ em đã đọc trong phần Help:
Excel Developer Reference
Ranges Object
A collection of Range objects that represent worksheets in a workbook.
Remarks
Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a workbook. Unlike a bookmark, however, a Range object exists only while the procedure that defined it is running.Range objects are independent of the selection. That is, you can define and manipulate a range without changing the selection. You can also define multiple ranges in a document, but there can be only one selection per pane.

Use the Range method to return a Range object defined by the given starting and ending character positions.

Use the Range property to return a Range object defined by the beginning and end of another object. The Range property applies to many objects.
© 2006 Microsoft Corporation. All rights reserved.
Range Collection
Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3-D range.
Vậy theo anh các sách đôi khi gọi là Object đôi khi gọi là Collection cũng đúng.
_Trong trường hợp này là Collection
Using the Range Collection
The following properties and methods for returning a Range object are described in this section:

Range property
Cells property
Range and Cells
Offset property
Union method

Vậy thì tùy trường hợp mà mình dùng Collection hay Object.
(Trong Help của Excel 2003 thì Range được tô màu xanh, và được ghi chú là Object only)

Lê Văn Duyệt
 
Web KT

Bài viết mới nhất

Back
Top Bottom