• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Storing entire columns as dictionary keys

PipBoy808

Member
Hello Chandoo. It's been a while.
I have a dynamic range of data
Code:
DataRange = Range(Cells(11, 4), Cells(LastDate, LastCol))
where LastDate and LastCol are functioning variables that help define the size of the range, as it will change over time. It's usually about 700 rows long and 60 columns wide.
I am attempting to create a dictionary in which each individual key is comprised of all the data in separate columns within DataRange. These keys will be outputted as an array later.
So for instance, key 1 would be all the data in the following range:
Code:
Range(Cells(11,4), Cells(LastDate,4))
My question is, how can I get Excel to store an entire column from this range as a key within a dictionary and then move onto the next column? If it were a single column of values where each cell were to be an individual key I'd do this:
Code:
For i = 1 To DataRange.Rows.Count
DataDict.Add DataRange(i, 1).Value, 1 'the '1' is arbitrary as a dictionary item can't be left blank
Next i
I just can't seem to get the syntax in such a way that Excel will store a group of cells from an entire column as a key.
 
Hi,

I well understand each range column is a Dictionary key
but I don't understand the purpose, once you have the Dictionary filled, what's for ?​
 
Back
Top