Question posted 2010 · +3 upvotes
How can I get the key of a dictionary by passing the index value?
I’m trying:
If rs.Fields("NM").Value = dictNM.key(0)
that is, I want it to compare to the first key in the dictionary
but I get the error
Compile error: Invalid use of property
I tried googling, but to no avail. I’m hoping this is even possible.
Accepted answer +10 upvotes
You should be able to use the Keys property:
dictNM.Keys(0)
Edit:
One thing to keep in mind is that the order of the keys is unspecified, see MSDN
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
.