Reputation: 15
I'm having trouble copying a range when using a variable to refer to the range being copied. The error i get is:
Run-time error '1004': Application-defined or object-defined error
Sub temp()
Dim Data As Range
Set Data = Range("A1:C1")
Range(Data).Copy Range("E1")
End Sub
There is no problem if i use
Range("A1:C1").Copy Range("E1")
I also tried
Range(Data).Copy Destination:=Range("E1")
I'm using Excel 2010. The above sample is part of a larger body of code. I've isolated the part which generates the error.
Thanks!
Upvotes: 0
Views: 70