I wrote a vba subroutine to concatenate a string with the loop incremental variable to form a new variable. However, it seems like it translate it as a string rather than the variable. I tried to find the solution and found one similar issue one user had asked, but I can not find the answer. I will be very grateful if you can provide the solution. Thank you very much!
The following is the post.
Const Value1 as long = 5
Const Value2 as long = 12
Const Value3 as long = 7
For i = 1 to 3
MsgBox Value & i '<-- How to do this properly?
Next i
I want MsgBox to display 5 then 12 then 7 rather than Value1 then Value2 then Value3
I can't figgure out how to get Value and i to combine properly to do this.
The following is the post.
Const Value1 as long = 5
Const Value2 as long = 12
Const Value3 as long = 7
For i = 1 to 3
MsgBox Value & i '<-- How to do this properly?
Next i
I want MsgBox to display 5 then 12 then 7 rather than Value1 then Value2 then Value3
I can't figgure out how to get Value and i to combine properly to do this.