0

I am running a VBA macro that involves multiple copy-paste processes. However, using .copy (destination) give a "Copy method of Range class failed." Here's that code.

Dim Prop As Range
Dim propo As Range
Set Prop = sha.Range("B6")
Set propo = Sheets("Summary").Range("B1")
Prop.Copy (propo)

However, I have found an odd work-around to this issue. Instead of .copy (destination) I use .copy and then .PasteSpecial:

Dim Prop As Range
Dim propo As Range
Set Prop = sha.Range("B6")
Set propo = Sheets("Summary").Range("B1")
Prop.Copy
propo.PasteSpecial (xlPasteValues)

Any idea why this was necessary? I would prefer to keep it simple going forward.

2
  • 2
    remove the () around propo Commented Dec 17, 2015 at 18:52
  • Thanks Scott! I'm surprised it was that simple Commented Dec 18, 2015 at 15:12

1 Answer 1

3

It appears that the reason this was necessary was that your syntax was incorrect. In the Microsoft doc for Range.Copy it lists that to add a destination, your code should be:

Worksheets("Sheet1").Range("A1:D4").Copy _ 
    destination:=Worksheets("Sheet2").Range("E5")

As shown here: https://msdn.microsoft.com/en-us/library/office/ff837760.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.