aProducts(lRow) = Array("Id Product", "Value A", "Value B")
'To copy value A
aProducts(lRow) = Array(.Cells(aPos(1)).Value2, .Cells(aPos(2)).Value2, Empty)
'To copy value B
aProducts(lRow) = Array(.Cells(aPos(1)).Value2, Empty, .Cells(aPos(3)).Value2)
Hi guys,
I use this piece of code in a loop to copy some values and their ID, but anyway, now I'd like to understand the usage of "Empty" in this code in order to add more value.
I tried:
aProducts(lRow) = Array("Id Product", "Value A", "Value B", "Value C")
'To copy value A
aProducts(lRow) = Array(.Cells(aPos(1)).Value2, .Cells(aPos(2)).Value2, Empty)
'To copy value B
aProducts(lRow) = Array(.Cells(aPos(1)).Value2, Empty, .Cells(aPos(3)).Value2)
'To copy value C
aProducts(lRow) = Array(.Cells(aPos(1)).Value2, Empty, Empty, .Cells(aPos(4)).Value2)
"Execusiion error 9"
Thanks in advance and sorry for my approximate english :/
EDIT 1
you can get the file here : https://drive.google.com/file/d/0B5DpGwPWsIfbWWlJRDAzZldYek0/view?usp=sharing
EDIT 2
Thanks to all of you, I just found that i've forgot to remove
ReDim Preserve aProducts(lRow)
