Is there a way to refer to a variable by constructing a string to represent its name?
For example, say I have the following variables:
• myLevel
• intLevel1
• intLevel2
• intLevel3
My code now looks like this:
I would really like it to look something like this (forgive the syntax–I know it doesn't work this way; hence the question):
For example, say I have the following variables:
• myLevel
• intLevel1
• intLevel2
• intLevel3
My code now looks like this:
Code:
Select Case myLevel
Case 1
intLevel1 = intLevel1 + 1
Case 2
intLevel2 = intLevel2 + 1
Case 3
intLevel3 = intLevel3 + 1
End Select
Code:
VariableName("intLevel" & myLevel)=VariableName("intLevel" & myLevel) + 1