In VBA, I would like to create a 2D array whose values can't be known at compile time.
I tried this:
Dim symbols As Object
Set symbols = CreateObject("System.Collections.ArrayList")
Dim dictionary As Object
Set dictionary = CreateObject("Scripting.Dictionary")
Dim entries As Integer
entries = dictionary.Count
Dim sheet(symbols.Count, entries) As String
Only entries
is highlighted.
I thought it came from the way I counted the dictionary size and that Excel highlighted the bad part of the code) so I tried entries = UBound(dictionary.keys)
I don't get why symbols.Count
isn't highlighted since it won't be known at compile time. Why is that?
How am I supposed to create an array without knowing its size?