Cyberdude
04-05-2006, 11:05 AM
In a previous thread posted by d_raghu9, TonyJollans recommended using ?enumeration? via the Enum statement. I was unable to understand the enumeration concept, and Tony tried to explain it to me. I decided this should be a separate thread so here it is folks.
I have defined a series of constants for the names of colors and planted the sequence in my Personal.xls workbook so I can use them by all my macros. The sequence of constants looks something like this:
Public Const NoColor& = 0
Public Const Red& = 3
Public Const SpclRed& = 51
Public Const SpclRedLt& = 36
Public Const SpclRedDk& = 38
Public Const DkRed& = 9
Public Const LtGreen& = 35
I assume that I could have used enumeration in my Personal.xls to create these definitions and write them something like this:
Public Enum MyColors
NoColor = 0
Red = 3
SpclRed = 51
SpclRedLt =36
SpclRedDk = 38
DkRed =9
LtGreen = 35
End Enum
Am I correct? My problem is that I don?t quite understand how the ?enum? technique is any better than the ?const? technique. What can I do with the ?enum? names that I can?t do with the ?const? names??
I have defined a series of constants for the names of colors and planted the sequence in my Personal.xls workbook so I can use them by all my macros. The sequence of constants looks something like this:
Public Const NoColor& = 0
Public Const Red& = 3
Public Const SpclRed& = 51
Public Const SpclRedLt& = 36
Public Const SpclRedDk& = 38
Public Const DkRed& = 9
Public Const LtGreen& = 35
I assume that I could have used enumeration in my Personal.xls to create these definitions and write them something like this:
Public Enum MyColors
NoColor = 0
Red = 3
SpclRed = 51
SpclRedLt =36
SpclRedDk = 38
DkRed =9
LtGreen = 35
End Enum
Am I correct? My problem is that I don?t quite understand how the ?enum? technique is any better than the ?const? technique. What can I do with the ?enum? names that I can?t do with the ?const? names??