I run a macro with the following code:
Dim myArray() As Variant
myArray = Worksheets("name1").Range("A1:B1").Value
Worksheets("name2").Range("A1:B1").Value = myArray
And it works fine, copying the cells from name1 to name2.
If I replace the code with this:
Dim myarray() As Variant
myarray = Worksheets("name1").Range(Cells(1, 1), Cells(1, 2)).Value
Worksheets("name2").Range(Cells(1, 1), Cells(1, 2)).Value = myarray
I get Run time error 1004: Application defined or object defined error
Why?
Many thanks!
Bookmarks