0

Basically we have terms for a university course, following the structure:

Term 1 2019
Term 2 2019
Term 3 2019
Term 1 2020
Term 2 2020
etc.

Is there a way to set a list with a specified order, and have VBA compare items in that list, returning information if the item is higher or lower?

My workaround has been appending the term number to the year (eg 20191, 20202 etc) and comparing by integer value. But I would like to know if there are any native or library functions that achieve the same result, as this problem has come up a couple of times in other areas.

Jack B
  • 1
  • where is your code? – Mech Oct 16 '20 at 02:34
  • 1
    You're doing it quite optimally, otherwise you have to resort to a data type, eg Collection that supports sorting. There is one other trick, you can use a UI control: https://stackoverflow.com/a/36646730/495455 - but I'd personally stick with the strategy you currently have. – Jeremy Thompson Oct 16 '20 at 02:54
  • 2
    I don't think VBA collection has a sort method and doesn't natively sort. You can sort with [ArrayList](https://excelmacromastery.com/vba-arraylist/) for example. Your current method is good. – QHarr Oct 16 '20 at 03:05

0 Answers0