user2491612
user2491612

Reputation:

Last key of a Dictionary Excel VBA

How do I do if I just want the last (inserted) key of a dictionary in excel-VBA?

Will I have to iterate all over the dict every time?

Upvotes: 1

Views: 4303

Answers (1)

chris neilsen
chris neilsen

Reputation: 53126

The .Keys property of a Dictionary is an 0 based array of the keys, in the order added.

To get the last added key, use

Dict.Keys(Dict.Count - 1)

Upvotes: 5

Related Questions