Day24 - Collection集合

今日学习目标

  • 理解Collection对象
  • 掌握集合的基本操作
  • 了解集合与数组的区别

知识点

### Collection对象
``vba
Dim col As New Collection
col.Add "item", "key"
col(i) ' 按索引访问
col("key") ' 按键访问
``

今日代码

Dim col As New Collection
col.Add "item", "key"
col(i)  ' 按索引访问
col("key")  ' 按键访问

练习题

  1. 创建并操作集合
  2. 遍历集合元素
  3. 使用集合去重