B
Brandt
I have declared several constants at the top of Module1 such as:
Option Explicit
Public Const BM1Left As Single = 10.1
Public Const BM2Left As Single = 20.1
Public Const BM3Left As Single = 30.1
Etc..
In the subroutine I would like to access them with a counter via
concatenating the name such as:
Sub Test1()
Dim Counter As Integer
Dim Left As Single
Counter = 1
Left = "BM" & Counter & "Left"
End Sub
Where counter could be set by a For loop or otherwise. (So that in the
above case the variable Left = BM1Left = 10.1) The above code does not work
because the expression is evaluated as a string rather than the name of the
Constant I want. Does anyone know how I could access the Const names similar
to the "indirect" worksheet function?
Thanks in advance
Option Explicit
Public Const BM1Left As Single = 10.1
Public Const BM2Left As Single = 20.1
Public Const BM3Left As Single = 30.1
Etc..
In the subroutine I would like to access them with a counter via
concatenating the name such as:
Sub Test1()
Dim Counter As Integer
Dim Left As Single
Counter = 1
Left = "BM" & Counter & "Left"
End Sub
Where counter could be set by a For loop or otherwise. (So that in the
above case the variable Left = BM1Left = 10.1) The above code does not work
because the expression is evaluated as a string rather than the name of the
Constant I want. Does anyone know how I could access the Const names similar
to the "indirect" worksheet function?
Thanks in advance