I have these values in range a1:a10 -
Now please look at these codes-
Code: Select all
Xl := ComObjActive("Excel.Application")
A := {}
for key, value in Xl.Range("a1:a11")
MsgBox % key ; shows empty msgbox
Now, when i try to show only the value which should be value of each cell like- 500, 600, 900, 100 so on till 900, by following codes then it shows 9 in each msgbox-
Code: Select all
Xl := ComObjActive("Excel.Application")
A := {}
for key, value in Xl.Range("a1:a11")
MsgBox % value ; shows 9 in each msgbox, very strange!!!!
SECOND EXAMPLE-
Code: Select all
arr:= {jone:"smith",sam:"donn",frank:"caine"}
for key,value in arr
MsgBox % key ; shows jonw, sam and frank
Now when i run following codes-
Code: Select all
arr:= {jone:"smith",sam:"donn",frank:"caine"}
for key,value in arr
MsgBox % value ; shows smith donn and caine
Then, it shows the value of each pair which is smith, donn and caine.
I am not understanding why each key and value is shown individually in second example, while it is not showing individual key and value of cell in first example?
Please help and guide me..
THANKS A LOT..