2016-10-04 6 views
0

私はコレクションのコレクションを持っています。内側のコレクションは文字列アイテムを保持します。インナーコレクションを充填ループのコレクションのコレクション

アウターコレクション充填
Function collect_excellent_Companies(ByVal folderName As String, ByVal fileName As String) As Collection 
.. 
    Do While .Cells(countGreens, 1).Interior.Color = 65280 
     myCol.Add CStr(.Cells(countGreens, 4).Value2) 
     countGreens = countGreens + 1 
    Loop 
... 
End Function 

For iRow = 1 To LastRow 
    param1 = .Cells(iRow, 1).Value2 + "-Info" 
    param2 = .Cells(iRow, 1).Value2 
    fullCollection.Add collect_excellent_Companies(param1, param2) 
Next iRow 

を今、私は

Dim sepCol As Collection 
Set sepCol = New Collection 
Dim tmpCol As Collection 
Set tmpCol = New Collection 
Dim myStr As Object 
'Loop over each competion 
For Each sepCol In myCol 
    For Each myStr In sepCol 
      tmpCol.Add myStr 
    Next myStr 
next sepCol 

と、外側と内側のコレクションをループにしたい私がチェックしていますこのループの前のコレクションの内容はすべてOKです。私が手にエラーが行である:

For each myStr in sepCol 

Runtime Error 424: Object necessary.私はすでにD im myStr as ObjectDim myStr as Stringを変えたが、これは役立ちません。私がこの仕事をした人はどんな考えでも大歓迎です!

+0

を設定しなければならなかった、あなたは論理的である私のコレクション、各コレクションのために言っているが、それは今まで何、それはアイテムです。 –

答えて

1

私自身が解決策を見つけました。

は、私はあなたがループにコレクション内の各項目を必要とする

Dim myStr as Variant 
+0

あなた自身の答えを受け入れることができない一定の期間があります!私は2日ほどそうだと思う。 – ruedi

関連する問題