
Originally Posted by
April15Hater
How about if you had code as follows?
Code:
Enum Weekday
Monday=1
Tuesday=3
Wednesday=4
Thursday=5
Friday=6
Saturday=7
Sunday=8
End Enum
Notice the skip over the 2 on the Tuesday Enumeration
Code:
For Day = Monday To Sunday
Debug.Print Day
Next Day
Will return : 1-8 in the immediate window.
Know of any way to test if a number is defined in an enum?
Regarding the first and last items in an Enum, just check the page by the great Chip Pearson
http://www.cpearson.com/excel/Enums.aspx
Simply transcribing, you can define your Enum as
Code:
Enum FruitType
[_First] = 1
Apple = 1
Orange = 2
Plum = 3
[_Last] = 3
End Enum
and later use
or
Unfortunately, some (perhaps all of?) built-in enums apparently do not have those definitions.