Sign in to follow this  

excel macros copy cells into array

Recommended Posts

capr    36

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.