我有一个这样的集合:
Dim BrokerCol as New Collection
'Added some data to the Collection
BrokerCol .Add temp_broker, BROKER_NAME
我正在像这样遍历集合:
For Each collectionitem In BrokerCol
If ((collectionitem.Bid - bid_average) / bid_average) < pThresholdValue Then
'Want to change something here in BrokerCol instead of Collection Item
Else
Next collectionitem
如前所述,上面我想更改 BrokerCol 中的某些内容,而不是更改 Collection Item。我怎么做?
我试过这个:
BrokerCol.Item(CollectionItem).Bid = 1
它给了我一个“类型不匹配”错误。不知道如何解决这个问题。
最佳答案
您是否尝试过仅使用
collectionitem.bid = 1
它与集合中的对象相同。
关于vba - 在 vba 中循环时更改原始集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32621847/