Skip to content
本页内容

Count (属性)

返回集合中对象的数目。只读 int 类型。

示例

python
#本示例显示活动工作表排序字段集合的数量
def test():
    print(Application.ActiveSheet.Sort.SortFields.Count)
python
#本示例在工作表Sheet1添加两个排序字段,并显示排序字段集合的数量
def test():
    sort = Application.Sheets.Item("Sheet1").Sort.SortFields
    sort.Add(Range("A1:D1"))
    sort.Add(Range("A2:D2"))
    print(sort.Count)