Hi Basanth,
I guess I am still confused at the disconnect here. It seems the 1st variable adj(0) has both values stored. I cannot separate them successfully. I understand the arrays concept but am not familiar with the Split function.
So I updated my code to print out the 2 values after the For statement:
adj = Split(val2, VBLF)
For i = Lbound(adj) to Ubound(adj)
msgbox adj(i)
Next
msgbox adj(0)
msgbox adj(1)
When I run this, msgbox adj(0) prints out:
TRAIN1
TRAIN2
and msgbox adj(1) throws an error:
Subscript out of range: '[number: 1]'
Line (37): "msgbox adj(1)".
I will look more into the Split function, but if you have further suggestions I appreciate the help...
-egun
Okay, From the Msgbox adj(0) it is clear that the split has not happened.
Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)
Okay, From the Msgbox adj(0) it is clear that the split has not happened.
Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)
Quickly, While you try the above, please try the below too,
Code:
adj = Split(Val2, VBCR)
msgbox adj(0)
Okay, From the Msgbox adj(0) it is clear that the split has not happened.
Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)
Okay, From the Msgbox adj(0) it is clear that the split has not happened.
Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)
Quickly, While you try the above, please try the below too,
Code:
adj = Split(Val2, VBCR)
msgbox adj(0)
Egun -
I have confirmed the below works fine and is the solution you are looking for.
Code:
adj = Split(val2, VBCR)
For i = Lbound(adj) to Ubound(adj)
msgbox adj(i)
Next
This should store the required values from adj(0), adj(1) etc...
Please try this and let me know if it works !! I am here for the next 10 mins hoping to see your reply.