Hi, I'm using Excel 2010 and am darn close to finishing a pretty cool spreadsheet I built with the exception of one problem I can't seem to solve. I a VBAS sub() that takes n pairs of two variables (n is usually < 50). The pairs are always made up of one integer and one string. For example, a pair could be 34, Peter. I want to push these pairs onto a "stack" and once all of them are on there, sort them by the integer number and then remove them from the "stack" in order. I can't use an indexed array (if that even exists in VBA) because the integer numbers don't have to be unique. What can I use? Collections? How would that work with the sort?
Here's an example, these are elements I want to push onto th stack: 3437, Chris 3, Peter 98, Mike 82, Mary 98, Kate (note, same iteger as for Mike) Then I want to sort the items by the integer and pop them off the stack like this: 3, Peter 82, Mary 98, Mike (could be Kate, doesn't matter in which order) 98, Kate (could be Mike, doesn't matter in which order) 3437, Chris Granted, a simple solution would just be to put the values into two columns in an Excel spreadsheet and then sort by the integer. I'm trying to avoid this though and make this a bit cleaner. Any help is greatly appreciated. Thanks, Christoph -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com