excel - Retrieving data from a collection in VBA -


i trying retrieve data have stored in collection in vba. not sure how retrieve data. gives me type mismatch error.

my code looks this:

set col = new collection col.add bgn_arr, "bgn" col.add cbbt_arr, "cbbt"  dim curr_arr() variant set curr_arr = col("bgn") 

tried well:

set curr_arr = col.item ("bgn") 

need guidance on this.

you have 2 issues see:

  1. you have set curr_arr() variant - should not array.
  2. you using set method cause issue.

this code should work:

set col = new collection col.add bgn_arr, "bgn" col.add cbbt_arr, "cbbt"  dim curr_arr variant curr_arr = col.item ("bgn") 

Comments