I'm trying to accept a formatting constant from a data cell, so I have a string "xlTotalsCalculationAverage". How can I translate that into the Excel constant it represents; the constant xlTotalsCalculationAverage
is equal to the integer 2.
ActiveSheet.ListObjects(1).ListColumns(RemainingHeader).TotalsCalculation = xlTotalsCalculationAverage
is a static representation.
TargetTotal = something("xlTotalsCalculationAverage")
ActiveSheet.ListObjects(1).ListColumns(RemainingHeader).TotalsCalculation = TargetTotal
is my goal.
I could make a huge case or switch statement, but it seem silly to duplicate all the possible values.
How can I make Excel convert this string to a known constant value?
See Question&Answers more detail:os