那是因为您将标题值数组分配给集合中的第一个项目。因此,您需要按如下方式遍历数组中的每个项目...
Dim item As Variant
For Each item In TmProducts(1)
Debug.Print item
Next item
但是,由于您可能希望将每个标题值分配给集合中的一个单独项目,因此您需要按如下方式分配它们...
Dim currentCell As Range
For Each currentCell In TmTable.ListObjects("Table1").HeaderRowRange
TmProducts.Add currentCell.Value
Next currentCell
然后,您可以按如下方式访问集合中的项目...
Dim item As Variant
For Each item In TmProducts
Debug.Print item
Next item
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句