Name Of An Enumeration Value

  • I am using EXCEL/VBA.


    Suppose x is an enumeration variable that has been assigned a value equal to a
    member name in the enumeration. Is there a function that maps the value of the
    enumeration to the string equivalent of the member name?


    i.e: if x = TEST_CASE_VALUE_1, I would hope there is a function f already
    avaiable such that f(x) returns the string "TEST_CASE_VALUE_1"


    Thanks All.

  • Re: Name Of An Enumeration Value


    I doubt there is such a function, because it wouldn't know which of many enumberation sets the value came from. For example, a value of 1 could have come from many sets (or none).

  • Re: Name Of An Enumeration Value


    joe31415,


    I can't tell what you're talking about yet. Are you using terms you learned from another programming language such as "enumeration variable"? Are you writing a VBA macro? Do you want a formula for a spreadsheet?


    Jim

  • Re: Name Of An Enumeration Value


    Hi, maybe best to illustrate with an example. Apologies to those expert coders whose eyes may be hurt parsing this...



    BUT... I don't like this approach, because my enumeration lists are quite long.
    So I hope there is some function already implemented to achieve this.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!