• 0

excel macros copy cells into array


Question

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

'input
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. 

 

 

 

SOLVED 

 

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
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.