I have an array that is looping:
I need to create a new variable, based on the array value.
A = Alpha
B = Beta
C = Charlie
D = Delta
E = Echo
The only way I know how to assign this is below:
I was hoping to find a way to do this that uses less lines of code. If I create a new array (like below), would I be able to assign values based on the locations in each array?
First Array: ("A", "B", "C", "D", "E")
Second Array: ("Alpha", "Beta", "Charlie", "Delta", "Echo")
Thanks
Code:
Sub Test()
Dim FileLoop As Variant, Found As Range
For Each FileLoop In Array ("A", "B", "C", "D", "E")
If FileLoop = [A1] then
MsgBox FileLoop
Next Fileloop
I need to create a new variable, based on the array value.
A = Alpha
B = Beta
C = Charlie
D = Delta
E = Echo
The only way I know how to assign this is below:
Code:
If FileLoop = A then FileLoop2 = Alpha
If FileLoop = B then FileLoop2 = Beta
If FileLoop = C then FileLoop2 = Charlie
If FileLoop = D then FileLoop2 = Delta
If FileLoop = E then FileLoop2 = Echo
I was hoping to find a way to do this that uses less lines of code. If I create a new array (like below), would I be able to assign values based on the locations in each array?
First Array: ("A", "B", "C", "D", "E")
Second Array: ("Alpha", "Beta", "Charlie", "Delta", "Echo")
Thanks