I want to assign certain time weightage values to the variables of a data set. So I am trying to use Enumerations/Constants so to improve my code quality and make it easy to maintain. But on compiling my project, it throws in a Circular Dependencies Between Modules error.
What I have understood is, one is allowed to use only constants [Eg: 2,3.14,56....], in the truest sense of the word. Bottom line, if I can't use Either Enumerations or Constants. Then how can I achieve my objective of keeping my weightages code-block, in a way that any changes in them is reflected everywhere in my project than me having to do a find and update manually every instance.
What I am getting at, is to have a global variable that can be accessed throughout the project and is dynamic.
Private Const Wtage As Double = ConvTohr(34) 'Error happens here
Enum Weightage
Var1_Weightage = ConvTohr(3) 'Error happens here
Var2_Weightage = ConvTohr(11)
Var3_Weightage = ConvTohr(2)
var4_Weightage = ConvTohr(9)
var5_Weightage = ConvTohr(0)
End Enum
Private Function ConvTohr(val As Integer) As Double
If val = 0 Then
ConvTohr = 0
Exit Function
End If
ConvTohr = Round((val / 60), 2)
End Function


Constvalues in VBA must be literals or an expression involving only other namedConsts. You cannot assign a function result to aConstfield in VBA.ConvTohrfunction returnsDoublebut yourWtageisInteger- you need to fix that first.expressionpart of the syntax.Enumtype can only useIntegerorLongvalues for its members, you cannot useDoublevalues forEnummembers (as yourConvTohrfunction returnsDouble).Class ModulewithGet-properties to expose those values (VBA doesn't support true singletons, but it can be worked-around: stackoverflow.com/a/4338092/159145 ).