Y
yunlai yang
Hi,
I tried to assign an array ro a range in Excel macro, but it does not work.
Here is the example
sub fill_range()
dim myArray(1 to 5) as single
dim i as integer
for i=1 to 5
myArray(i)=i
next
sheets("sheet1").activate
range("a1:a5")=myArray
end sub
When the macro is run, the values of cells a1 to a5 are 1 instead of 1 to
5. That is all the cells in the range took the value of myArray(1) instead
correspondent (right) ones.
Any suggestions on solving this problem?
Thanks
My e-mail address:
(e-mail address removed). or
(e-mail address removed)
I tried to assign an array ro a range in Excel macro, but it does not work.
Here is the example
sub fill_range()
dim myArray(1 to 5) as single
dim i as integer
for i=1 to 5
myArray(i)=i
next
sheets("sheet1").activate
range("a1:a5")=myArray
end sub
When the macro is run, the values of cells a1 to a5 are 1 instead of 1 to
5. That is all the cells in the range took the value of myArray(1) instead
correspondent (right) ones.
Any suggestions on solving this problem?
Thanks
My e-mail address:
(e-mail address removed). or
(e-mail address removed)