Jump to content


excel macros copy cells into array

  • Please log in to reply
No replies to this topic

#1 capr


    Neowinian Senior

  • Joined: 01-July 05

Posted 30 September 2013 - 21:51

ok so very simple function. I want a range of cells (doubles type) to go into an array. then i manipulate the double array and print the end results. 


code should be simple so here we go

Dim Data As Double

Data = Range(Cells(1, 1), Cells(4, 4)).Value
(manipulate Data)
Range(Cells(5, 1), Cells(9, 4)).Value = Data

first issue is a type mismatch. i don't know why... I think range is giving me a variant type which is fine as long as I will be able to manipulate the values as if they were doubles. 


second issue when I go to display the results with the last line. it doesn't work right. I get the data i want but also get a bunch of #N/A values all around the data. no idea what that's about. 


any help would be great. 


I tried replicating this in another workbook but couldn't... could formatting on the original range cause issues? I would have thought .value will ignore formatting. 






sorry I figured it out. was making mistakes with the sizes. Anyone reading this the #N/A means your array isn't that big so the last range function is incorrect in dimensions. 

Edited by capr, 30 September 2013 - 22:27.