VBA Help - See anything wrong with my Copy/Paste Statement? Getting an Error 450

Johnny Thunder

Well-known Member
Joined
Apr 9, 2010
Messages
693
Office Version
  1. 2016
Platform
  1. MacOS
Hi group,

I am working on a piece of code that seemed to work in the past and now I am getting a weird error? "Error 450: Wrong number of arguments or invalid property assignment".


I have marked the line with the error below.

I have tried several variations of the line to see if I could troubleshoot but no luck.

With Sheets("DPL YR2")
.Visible = True
.Unprotect
.Select
.Range("BS58").ClearContents
.Range("A58:BN58").ClearContents
.Range("BS134").ClearContents
.Range("A134:BN134").ClearContents

.Range("P2").FormulaR1C1 = _
"=IF(OR(R1C<=PDACTUALS),0,IF(ABS(SUM(R15C:R165C)-ROUND(SUMIF('CF-LOC'!R11,R1C,'CF-LOC'!R115)*LOADSCALE,2)+ROUND(SUMIF('CF-LOC'!R11,R1C,'CF-LOC'!R128)*LOADSCALE,2))<loadchk1,0,(sum(r15c:r165c)-round(sumif('cf-loc'!r11,r1c,'cf-loc'!r115)*loadscale,2)+round(sumif('cf-loc'!r11,r1c,'cf-loc'!r128)*loadscale,2))))"


.Range("P2").Copy
.Range("T2", "X2", "AB2", "AF2", "AJ2", "AN2", "AR2", "AV2", "AZ2", "BD2", "BH2").Paste <------------------- Getting the error here-----------------------
Application.CutCopyMode = False
.Calculate
End With

Other Variations -

Variation1
Code:
.Range("P2").Copy .Range("T2", "X2", "AB2", "AF2", "AJ2", "AN2", "AR2", "AV2", "AZ2", "BD2", "BH2") '-----Errors out as well

Variation2
Code:
.Range("T2", "X2", "AB2", "AF2", "AJ2", "AN2", "AR2", "AV2", "AZ2", "BD2", "BH2").value = .Range("P2").Value '-----Errors out as well
</loadchk1,0,(sum(r15c:r165c)-round(sumif('cf-loc'!r11,r1c,'cf-loc'!r115)*loadscale,2)+round(sumif('cf-loc'!r11,r1c,'cf-loc'!r128)*loadscale,2))))"
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
i believe in your range, the quotation marks go around the entire contents of the range so for example

instead of
Range("A1","A2","A3")

i think it should be
Range("A1, A2, A3")
 
Upvote 0
With your proposed changes I now get an error, "Run-Time Error 438: Object doesn't support this property or method"

i believe in your range, the quotation marks go around the entire contents of the range so for example

instead of
Range("A1","A2","A3")

i think it should be
Range("A1, A2, A3")
 
Upvote 0
How about
Code:
.Range("P2").Copy .Range("T2, X2, AB2, AF2, AJ2, AN2, Ar2, AV2, AZ2, BD2, BH2")
 
Upvote 0
That did it!

To Nine Zero's defense his comments worked, he just needed to clarify on how to rewrite.

Thanks for the help Fluff!

How about
Code:
.Range("P2").Copy .Range("T2, X2, AB2, AF2, AJ2, AN2, Ar2, AV2, AZ2, BD2, BH2")
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
another solution could be to maybe just set the values of those cells to the value of P2

Code:
.Range("T2").Value = .Range("P2").Value
.Range("X2").Value = .Range("P2").Value
.Range("AB2").Value = .Range("P2").Value
.Range("AF2").Value = .Range("P2").Value
.Range("AJ2").Value = .Range("P2").Value
.Range("AN2").Value = .Range("P2").Value
.Range("AR2").Value = .Range("P2").Value
.Range("AV2").Value = .Range("P2").Value
.Range("AZ2").Value = .Range("P2").Value
.Range("BD2").Value = .Range("P2").Value
.Range("BH2").Value = .Range("P2").Value

EDIT: I see you got it working and yeah you are correct, i should have given the whole explanation thanks for the feedback
 
Last edited:
Upvote 0
You can replace this:
Code:
    [COLOR=#333333].Range("P2").Copy[/COLOR]
[COLOR=#333333]    .Range("T2", "X2", "AB2", "AF2", "AJ2", "AN2", "AR2", "AV2", "AZ2", "BD2", "BH2").Paste <------------------- Getting the error here-----------------------[/COLOR]
[COLOR=#333333]    Application.CutCopyMode = False[/COLOR]
with this:
Code:
        For Each cell In .Range("T2, X2, AB2, AF2, AJ2, AN2, AR2, AV2, AZ2, BD2, BH2")
            cell = .Range("P2")
        Next cell
 
Last edited:
Upvote 0
When Nine Zero posted his/her solution you had not modified your op, & so we could only have seen your 2 variations & not the original code.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top